From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Stephen Frost <sfrost(at)snowman(dot)net> |
Cc: | "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, Joe Conway <mail(at)joeconway(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Merlin Moncure <mmoncure(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>, David Steele <david(at)pgmasters(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Request: pg_cancel_backend variant that handles 'idle in transaction' sessions |
Date: | 2015-11-04 23:08:51 |
Message-ID: | CAFj8pRBtYpKNy9shbVkt=bDBgy8Y4wVnnPNacKh8azPh_OirGQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
2015-11-04 23:53 GMT+01:00 Stephen Frost <sfrost(at)snowman(dot)net>:
> JD,
>
> On Wednesday, November 4, 2015, Joshua D. Drake <jd(at)commandprompt(dot)com>
> wrote:
>
>> On 11/04/2015 02:15 PM, Stephen Frost wrote:
>>
>> Yeah but anything holding a lock that long can be terminated via
>>>> statement_timeout can it not?
>>>>
>>>
>>> Well, no? statement_timeout is per-statement, while transaction_timeout
>>> is, well, per transaction. If there's a process which is going and has
>>> an open transaction and it's holding locks, that can be an issue.
>>>
>>
>> No, what I mean is this:
>>
>> BEGIN;
>> select * from foo;
>> update bar;
>> delete baz;
>>
>> Each one of those is subject to statement_timeout, yes? If so, then I
>> don't see a point for transaction timeout. You set statement_timeout for
>> what works for your environment. Once the timeout is reached within the
>> statement (within the transaction), the transaction is going to rollback
>> too.
>>
>
> This implies that a statement used takes a long time. It may not. The lock
> is held at the transaction level not the statement level, which is why a
> transaction level timeout is actually more useful than a statement level
> timeout.
>
It hard to compare these proposals because any proposal solves slightly
different issue and has different advantages and disadvantages. The flat
solution probably will by too limited. I see a possible advantages of
transaction_timeout (max lock duration), transaction_idle_timeout,
statement_timeout. Any of these limits has sense, and can helps with
resource management. There is not full substitution.
Regards
Pavel
>
> What I'm most interested in, in the use case which I described and which
> David built a system for, is getting that lock released from the lower
> priority process to let the higher priority process run. I couldn't care
> less about statement level anything.
>
> Thanks!
>
> Stephen
>
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Verite | 2015-11-04 23:34:56 | Re: [patch] Proposal for \rotate in psql |
Previous Message | Daniel Verite | 2015-11-04 23:07:40 | Re: [patch] Proposal for \rotate in psql |