Subject: 2-phase locks and deadlocks

From: [email-masked] (Alfredo Sanchez)
Date: Tue, 10 Mar 92 08:45:36 -0800

dear pg developers,

when doing postquel queries within
a transaction, is there any fixed order
in which locks are acquired, or could it be
different depending upon the particular situation
when the transaction starts?

any news about release 4.0?

thanks,

J Alfredo Sanchez H
-------------------
Hypertext Research Lab
Department of Computer Science
Texas A&M University

---

From: postarch (Postgres Mailing Archive)
Date: Tue, 10 Mar 92 14:44:53 PST

> when the transaction starts?

The locks are acquired on an as-needed basis.  That is if you scan
a relation (e.g. during a retrieve) a read lock is acquired before the
scan begins.  If you are appending tuples into a relation a write lock
is acquired before the insert takes place.  So the order that locks
are acquired depends on the order of operations in the xaction block.
When you are inside such a block, acquired locks will not be released
until you "end" it.  At the end of each and every xaction all locks
for that xaction are released (complying with 2-pl protocol).

> any news about release 4.0?

I will make an announcement later today.

Jeff Meredith
[email-masked]