table-level and row-level locks.

Started by Jenny -over 22 years ago5 messages
#1Jenny -
nat_lazy@hotmail.com

<html><div style='background-color:'><DIV>Iam trying to acquire rowlevel locks in postgresql. I try doing this: </DIV>
<DIV>&nbsp;'select * from students where name='Larry' for update;</DIV>
<DIV>But by looking at the holding array of proclock , I've noticed that by doing this only
<DT>AccessShareLock gets acquired which is a table level lock. </DT>
<DT>How do I acquire rowlevelock and what fields of Lock or Proclock datastructures indicate it.</DT>
<DT>Thanks</DT>
<DT>Jenny</DT></DIV></div><br clear=all><hr>MSN 8 with <a href="http://g.msn.com/8HMRENUS/2740??PS=&quot;&gt;e-mail virus protection service: </a> 2 months FREE*</html>

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Jenny - (#1)
Re: table-level and row-level locks.

"Jenny -" <nat_lazy@hotmail.com> writes:

<html><div style='background-color:'><DIV>Iam trying to acquire rowlevel locks in postgresql. I try doing this: </DIV>
<DIV>&nbsp;'select * from students where name='Larry' for update;</DIV>
<DIV>But by looking at the holding array of proclock , I've noticed that by doing this only
<DT>AccessShareLock gets acquired which is a table level lock. </DT>

Please do not use HTML mail on this list ...

Anyway, the answer to your question is that row locks are recorded on
disk (by marking the tuple as locked). We'd soon run out of memory
if we tried to record them in the shared lock table.

regards, tom lane

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Jenny - (#1)
Re: table-level and row-level locks.

Koichi Suzuki <suzukikui@nttdata.co.jp> writes:

I need to know where such "lock marks" are stored in the source level.

A row lock is represented by storing the locking transaction's ID in
xmax and setting the HEAP_MARKED_FOR_UPDATE infomask bit. The bit is
needed to distinguish this from the case where the transaction is
deleting the tuple.

regards, tom lane

#4Jenny -
nat_lazy@hotmail.com
In reply to: Tom Lane (#3)
Re: table-level and row-level locks.

A row lock is represented by storing the locking transaction's ID in
xmax and setting the HEAP_MARKED_FOR_UPDATE infomask bit.

Where is 'xmax' found? is it at code level or on disk?
thanks
Jenny

From: Tom Lane <tgl@sss.pgh.pa.us>
To: suzukikui@nttdata.co.jp
CC: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] table-level and row-level locks. Date: Wed, 20 Aug
2003 14:45:23 -0400

Koichi Suzuki <suzukikui@nttdata.co.jp> writes:

I need to know where such "lock marks" are stored in the source level.

A row lock is represented by storing the locking transaction's ID in
xmax and setting the HEAP_MARKED_FOR_UPDATE infomask bit. The bit is
needed to distinguish this from the case where the transaction is
deleting the tuple.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

_________________________________________________________________
Get MSN 8 and help protect your children with advanced parental controls.
http://join.msn.com/?page=features/parental

#5Jenny -
nat_lazy@hotmail.com
In reply to: Jenny - (#4)
Re: table-level and row-level locks.

if table and page are locked in src/backend/storage/lmgr/lmgr.c by
LockRelation() and LockPage respectively, in which file and by which
function is a row locked?
thanks
Jenny

From: "Jenny -" <nat_lazy@hotmail.com>
To: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] table-level and row-level locks.
Date: Sun, 24 Aug 2003 11:30:41 -0700

A row lock is represented by storing the locking transaction's ID in
xmax and setting the HEAP_MARKED_FOR_UPDATE infomask bit.

Where is 'xmax' found? is it at code level or on disk?
thanks
Jenny

From: Tom Lane <tgl@sss.pgh.pa.us>
To: suzukikui@nttdata.co.jp
CC: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] table-level and row-level locks. Date: Wed, 20 Aug
2003 14:45:23 -0400

Koichi Suzuki <suzukikui@nttdata.co.jp> writes:

I need to know where such "lock marks" are stored in the source level.

A row lock is represented by storing the locking transaction's ID in
xmax and setting the HEAP_MARKED_FOR_UPDATE infomask bit. The bit is
needed to distinguish this from the case where the transaction is
deleting the tuple.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

_________________________________________________________________
Get MSN 8 and help protect your children with advanced parental controls.
http://join.msn.com/?page=features/parental

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

_________________________________________________________________
MSN 8: Get 6 months for $9.95/month. http://join.msn.com/?page=dept/dialup