Re: [HACKERS] FOR SHARE LOCK clause ?

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: vadim(at)krs(dot)ru (Vadim Mikheev)
Cc: lockhart(at)alumni(dot)caltech(dot)edu, hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] FOR SHARE LOCK clause ?
Date: 1999-01-06 04:25:31
Message-ID: 199901060425.XAA23336@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Bruce Momjian wrote:
> >
> > > > I think lock escalation is nice. Locking every row makes for lock
> > > > resource problems. I would recommend locking a single row, and if a
> > > > second row needs to be locked, just escalate to lock the whole table...
> > > > if that can be done. This would seem to be the most reasonable and
> > > > easiest to do.
> > >
> > > Easiest to do is don't worry about # of locks -:)
> > > Let's be on this way for 6.5
> >
> > You mean just share-lock the whole table. I agree. It is a pretty rare
> > situation.
>
> No. User may use LOCK TABLE IN SHARE MODE for this.
> I propose SELECT FOR SHARE LOCK as alternative to
> LOCK TABLE IN SHARE MODE and SELECT FOR UPDATE and
> would like to share lock each row selected with
> FOR SHARE LOCK clause in use. I don't know what's
> real limitations of # locks, but I think that
> a tens of locks is Ok.

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?

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vadim Mikheev 1999-01-06 04:25:47 Re: [HACKERS] FOR SHARE LOCK clause ?]
Previous Message Vadim Mikheev 1999-01-06 04:16:10 Re: [HACKERS] FOR SHARE LOCK clause ?