At 10:45 23/10/00 -0400, Tom Lane wrote:
>Philip Warner <pjw@rhyme.com.au> writes:
>> Don't we have this ability? What about taking a RowShare lock on the
>> pg_class tuple whenever you read from the table; then requiring schema
>> updates take a RowExclusive lock on the pg_class tuple?
>
>How is that different from taking locks on the table itself?
Only slightly; one interpretation of a table lock is that it locks all of
the data in the table; and a lock on the pg_class row locks the metadata. I
must admit that I am having a little difficulty thinking of a case where
the distinction would be useful...
>In any case, we don't have the ability to hold multiple classes of locks
>on individual tuples, AFAIK. UPDATE and SELECT FOR UPDATE use a
>different mechanism that involves setting fields in the header of the
>affected tuple. There's no room there for more than one kind of lock;
>what's worse, checking and waiting for that lock is far slower than
>normal lock-manager operations.
So where do
SELECT FOR UPDATE IN ROW SHARE MODE
and LOCK TABLE IN ROW EXCLUSIVE MODE statements.
fit in?
They *seem* to provide differing levels of row locking.
----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.B.N. 75 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 0500 83 82 82 | ___________ |
Http://www.rhyme.com.au | / \| | --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/