Re: Processing a work queue

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: Processing a work queue
Дата
Msg-id 46375203.7040305@magproductions.nl
обсуждение исходный текст
Ответ на Re: Processing a work queue  ("Merlin Moncure" <mmoncure@gmail.com>)
Ответы Re: Processing a work queue  ("Merlin Moncure" <mmoncure@gmail.com>)
Список pgsql-general
Merlin Moncure wrote:
> ok, here's an example.  I was thinking that my sequence idea might not
> be safe because of race conditions revolving around querying the
> sequence table.  Here is how I might use advisory locks eliminate the

I've seen your name pop up regularly on this list (or are you from
freebsd-stable?), so you kind of got me scratching my head whether you
really don't understand sequences. Kind of hard to imagine... Maybe I
don't understand what you're asking.

Sequences are safe in concurrent use.
* Nextval() always returns a new number, so no two concurrent sessions
can get the same one.
* Currval() is only valid within one session after calling nextval(), so
it's number cannot have been modified by another session.

Why do you expect to need locking?

--
Alban Hertroys
alban@magproductions.nl

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
   7500 AK Enschede

// Integrate Your World //

В списке pgsql-general по дате отправления:

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: [HACKERS] SOS, help me please, one problem towards the postgresql developement on windows
Следующее
От: Tom Lane
Дата:
Сообщение: Re: dump-restore only one table