granularity of locks in postgresql

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

The following lines are from readme file present in the
\src\backend\storage\lmgr folder of postgresql

"If we are setting a table level lock
Both the blockId and tupleId (in an item pointer this is called
the position) are set to invalid, if it is a page level lock the
blockId is valid, while the tupleId is still invalid. Finally if
this is a tuple level lock (we currently never do this) then both
the blockId and tupleId are set to valid specifications."

I dont see any field called tupleId in LockTag..does it have another name?
Also, "(we currently never do this)"--> does this mean that we currently can
acquire tuplelevel(row level) locks in postgresql?
Thank you
Jenny

_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail

#2Alvaro Herrera
alvherre@dcc.uchile.cl
In reply to: Jenny - (#1)
Re: granularity of locks in postgresql

On Sat, Jul 26, 2003 at 10:59:49AM -0700, Jenny - wrote:

The following lines are from readme file present in the
\src\backend\storage\lmgr folder of postgresql

"If we are setting a table level lock
Both the blockId and tupleId (in an item pointer this is called
the position) are set to invalid, if it is a page level lock the
blockId is valid, while the tupleId is still invalid. Finally if
this is a tuple level lock (we currently never do this) then both
the blockId and tupleId are set to valid specifications."

I dont see any field called tupleId in LockTag..does it have another name?

I think the tupleId is actually represented by the pair
BlockNumber blkno, OffsetNumber offno

Also, "(we currently never do this)"--> does this mean that we currently
can acquire tuplelevel(row level) locks in postgresql?

It should work, but think about memory requirements if you want to
acquire a lot of those.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Those who use electric razors are infidels destined to burn in hell while
we drink from rivers of beer, download free vids and mingle with naked
well shaved babes." (http://slashdot.org/comments.pl?sid=44793&amp;cid=4647152)