Re: sequence locking

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: "Andres Freund" <andres(at)anarazel(dot)de>, "PG Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: sequence locking
Date: 2011-09-21 17:24:55
Message-ID: 25780.1316625895@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> writes:
> Andres Freund <andres(at)anarazel(dot)de> wrote:
>> - Its impossible to emulate proper locking yourself because
>> locking is not allowed for sequences

>> Any arguments against allowing it again? It seems to have been
>> allowed in prehistoric times.

If you think that it used to be allowed, it'd be a good idea to see
if you can find the archived discussions about changing it.

> It would be nice to allow it. I've had to create a dummy table just
> to use for locking a sequence (by convention).

One question is what you think the lock means. I believe for example
that taking a non-exclusive regular table lock on a sequence would not
prevent other sessions from doing nextval(); even an exclusive one would
not prevent them from doing so if they had pre-cached values.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Aidan Van Dyk 2011-09-21 17:34:55 Re: unite recovery.conf and postgresql.conf
Previous Message Robert Haas 2011-09-21 17:23:49 Re: Hot Backup with rsync fails at pg_clog if under load