Re: Why is AccessShareLock held until end of transaction?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Why is AccessShareLock held until end of transaction?
Date: 2014-03-11 03:41:06
Message-ID: 30114.1394509266@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2014-03-11 03:59:40 Re: issue log message to suggest VACUUM FULL if a table is nearly empty
Previous Message Amit Kapila 2014-03-11 03:35:26 Re: [bug fix] pg_ctl always uses the same event source