Re: this is in plain text (row level locks)

From: Sailesh Krishnamurthy <sailesh(at)cs(dot)berkeley(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jenny - <nat_lazy(at)hotmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: this is in plain text (row level locks)
Date: 2003-07-24 01:12:21
Message-ID: bxyfzkwwwwa.fsf@datafix.cs.berkeley.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>>>> "Tom" == Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

Tom> "Jenny -" <nat_lazy(at)hotmail(dot)com> writes:
>> Iam trying to acquire rowlevel locks in postgresql. I try doing
>> this: 'select * from students where name='Larry' for update;
>> But by looking at the holding array of proclock , I've noticed
>> that by doing this only AccessShareLock gets acquired which is
>> a table level lock.

Tom> Row-level locks are not recorded in proclock --- they are
Tom> implemented by marking the individual tuple on-disk. If we
Tom> tried to record them in shared memory, it'd be very easy to
Tom> run out of shared memory, because you could be holding row
Tom> locks on a large number of tuples.

Of course, other database systems do this without too much hassle
.. including relying on lock escalation (move up to page/table level
locks) when the number of locks grow too large.

Does pgsql only record X locks on the individual tuples on-disk or
does it do so for S locks as well ?

Not that I dislike the idea - Toby Lehman suggested this in his
Ph.D. thesis in the mid-eighties for main-memory databases (where you
don't take the write penalty).

--
Pip-pip
Sailesh
http://www.cs.berkeley.edu/~sailesh

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2003-07-24 01:59:44 Re: this is in plain text (row level locks)
Previous Message Tom Lane 2003-07-24 00:36:30 Re: this is in plain text (row level locks)