Re: Why is AccessShareLock held until end of transaction?

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Atri Sharma <atri(dot)jiit(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Joe Conway <mail(at)joeconway(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why is AccessShareLock held until end of transaction?
Date: 2014-03-11 17:37:33
Message-ID: CA+U5nMKM4q9aa6X+wUzEiXUBz-7LUS_TS8oBfHwrga1PDQ71LQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11 March 2014 17:29, Atri Sharma <atri(dot)jiit(at)gmail(dot)com> wrote:
>
>
>
> On Tue, Mar 11, 2014 at 10:56 PM, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
>>
>> On 11 March 2014 03:41, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> > Joe Conway <mail(at)joeconway(dot)com> writes:
>> >> I am probably missing something obvious, but why does the
>> >> AccessShareLock remain held on a table after a SELECT statement is
>> >> complete when in a transaction block?
>> >
>> > *Any* lock acquired by user command is held till end of transaction;
>> > AccessShareLock isn't special.
>> >
>> > In general, releasing early would increase the risk of undesirable
>> > behaviors such as tables changing definition mid-transaction.
>>
>> I thought "good question" at first, but the workaround is simple...
>> just don't use multi-step transactions, submit each request as a
>> separate transaction.
>>
>>
> Wouldnt that tend to get inefficient?

Please outline your alternate proposal so we can judge the comparative
efficiency.

--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Atri Sharma 2014-03-11 17:41:01 Re: Why is AccessShareLock held until end of transaction?
Previous Message Atri Sharma 2014-03-11 17:29:01 Re: Why is AccessShareLock held until end of transaction?