From: | Simon Riggs <simon(at)2ndQuadrant(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | 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:26:23 |
Message-ID: | CA+U5nM+hmM+k1Sc7m6ztbehHa9w3d_o_c_YdO1D0VYj6GgN0Cg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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.
--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2014-03-11 17:26:25 | Re: [PATCH] Store Extension Options |
Previous Message | Robert Haas | 2014-03-11 17:23:06 | Re: Retain dynamic shared memory segments for postmaster lifetime |