Re: questions about concurrency control in Postgresql - Mailing list pgsql-hackers

From Daniel Farina
Subject Re: questions about concurrency control in Postgresql
Date
Msg-id 7b97c5a40912072201h6575201eid6597fc42052dd18@mail.gmail.com
Whole thread Raw
In response to questions about concurrency control in Postgresql  (黄晓骋 <huangxclife@gmail.com>)
List pgsql-hackers
2009/12/7 黄晓骋 <huangxclife@gmail.com>:
> Hello,
>
> I think in Postgresql, concurrency control acts like this:
>
> tuple's infomask shows if it is being updated. If it is being updated now,
> the latter transaction should reread the tuple and get the newer tuple.
> During the progress of getting the newer tuple, it must use transaction
> lock, I mean XactLockTableWait(...).

That is a table lock...depending on the lock, other backends may be
allowed to update tuples in the relation still.  Fine-grained tuple
locks are used to prevent unnecessary contention for a table-wide
lock.

See the documentation at the manual page:

http://www.postgresql.org/docs/8.4/static/explicit-locking.html

It gives a thorough treatment of table and row locking levels and
conflicts, as well as what gets what locks.

fdr


pgsql-hackers by date:

Previous
From: Greg Smith
Date:
Subject: Re: EXPLAIN BUFFERS
Next
From: Heikki Linnakangas
Date:
Subject: Re: WAL format