Re: [HACKERS] FOR SHARE LOCK clause ? - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] FOR SHARE LOCK clause ?
Date
Msg-id 199901060445.XAA24402@candle.pha.pa.us
Whole thread Raw
In response to Re: [HACKERS] FOR SHARE LOCK clause ?  (Vadim Mikheev <vadim@krs.ru>)
List pgsql-hackers
> > So you are going to shared lock every row.  And if a user does a
> > sequential scan of the entire table using SELECT FOR SHARE LOCK, he
> > shared locks every row.  Isn't he going to run out of locks?
> 
> I would like to work with this issue after 6.5 and writes
> some notes about FOR SHARE LOCK limitations/problems.

OK, just checking.  You can't use the xid, so I see the problem with
shared-locking.  No way to know which rows were seen by SELECT, so no
way to shared-lock them without an explicit lock.

With Informix, UPDATE automatically locks every row, and you quickly run
out of locks.  You have to explicitly lock the table in EXCLUSIVE MODE
in a transaction to prevent your UPDATE from running out of locks on a
large transaction.  And you can still run out of log space or generate a
'large transaction' errror because the log got full before the
transaction finished.  With MVCC, these are not problems, and FOR SHARED
LOCK is just a special thing people can enable for special cases.

--  Bruce Momjian                        |  http://www.op.net/~candle maillist@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Vadim Mikheev
Date:
Subject: Re: [HACKERS] FOR SHARE LOCK clause ?
Next
From: Clark Evans
Date:
Subject: Re: [HACKERS] FOR SHARE LOCK clause ?