Re: do postgresql this job for me ? (firebird user) - Mailing list pgsql-general

From Tom Lane
Subject Re: do postgresql this job for me ? (firebird user)
Date
Msg-id 3027.1243262380@sss.pgh.pa.us
Whole thread Raw
In response to Re: do postgresql this job for me ? (firebird user)  (Craig Ringer <craig@postnewspapers.com.au>)
Responses Re: do postgresql this job for me ? (firebird user)
List pgsql-general
Craig Ringer <craig@postnewspapers.com.au> writes:
> The locking docs:
> http://www.postgresql.org/docs/8.3/static/explicit-locking.html
> don't say anything about which lock DROP INDEX takes on a relation. A
> quick test shows it takes an AccessExclusiveLock on the affected index,
> and appears to take no lock at all on the table:

Not sure how you tested that, but index_drop() clearly takes
AccessExclusiveLock on the table too.  (I'm not sure it really needs
to --- the comment therein defending the reasoning seems out of date
--- but it definitely does.)

Whether it did lock the table or not, though, the index lock would
certainly interfere with queries trying to use that index, or even just
considering using the index during planning.  So the recommended
method (CREATE new index, DROP old, RENAME) is designed to hold lock
on the old index for as short a time as possible.

            regards, tom lane

pgsql-general by date:

Previous
From: Johan Nel
Date:
Subject: Re: Question on Foreign Key Structure/Design
Next
From: "Bayless Kirtley"
Date:
Subject: Re: Daylight saving time question