Table-Level Locks and Transactions - Mailing list pgsql-novice

From Greg Rychlewski
Subject Table-Level Locks and Transactions
Date
Msg-id CAKemG7XD-UU7AGan+jp5jtw+6wwcN4z3pPSB=DuoAC1z3JDDhg@mail.gmail.com
Whole thread Raw
Responses Re: Table-Level Locks and Transactions  (Simon Riggs <simon.riggs@enterprisedb.com>)
List pgsql-novice
Hi,

I'm curious to understand when table-level locks are released by one transaction to use in another.

For instance, say I have the following transaction, where index1 and index2 both belong to the same table.

BEGIN;
DROP INDEX index1;
CREATE INDEX index2;
COMMIT;

This transaction acquires an ACCESS EXCLUSIVE lock during the DROP INDEX step and then acquires a SHARE lock during the CREATE INDEX step. 

I understand that there will be no conflicts between the statements in this transaction, but I'm wondering if an outside transaction will think that the table has an ACCESS EXCLUSIVE lock until this entire transaction is completed.

Thanks

pgsql-novice by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Simple question about running a function.
Next
From: Simon Riggs
Date:
Subject: Re: Table-Level Locks and Transactions