Thread: table-level and row-level locks.

table-level and row-level locks.

From
"Jenny -"
Date:
<div style="background-color:"><div>Iam trying to acquire rowlevel locks in postgresql. I try doing this:
</div><div> '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 <dl><dt>AccessShareLock gets acquired which is a table level lock.
<dt>Howdo I acquire rowlevelock and what fields of Lock or Proclock datastructures indicate
it.<dt>Thanks<dt>Jenny</dl></div></div><brclear="all" /><hr />MSN 8 with <a
href="http://g.msn.com/8HMRENUS/2740??PS=">e-mailvirus protection service: </a> 2 months FREE* 

Re: table-level and row-level locks.

From
Tom Lane
Date:
"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> '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


Re: table-level and row-level locks.

From
Koichi Suzuki
Date:
Hi,

I understand this is very old topics but ...
I tried to find where such lock mark is defined in each tuple on disk, but I
failed to find such definition in include/access/htup.h.  Only the bit
relevant to lock is HEAP_XMAX_UNLOGGED and I understand this bit is used only
when we have to split a big tuple into multiple blocks or to toast it.

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

Any hint is appreciated.

Thanks, 

Koichi Suzuki, NTT DATA Intellilink Corp.


土曜日 12 7月 2003 00:17、Tom Lane さんは書きました:

> 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
>





Re: table-level and row-level locks.

From
Tom Lane
Date:
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