Re: pg_sequence catalog

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: pg_sequence catalog
Дата
Msg-id 20160831155645.GA553923@alvherre.pgsql
обсуждение исходный текст
Ответ на Re: pg_sequence catalog  (Andres Freund <andres@anarazel.de>)
Ответы Re: pg_sequence catalog  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
Andres Freund wrote:
> On 2016-08-31 11:23:27 -0400, Tom Lane wrote:
> > Another issue is what is the low-level interlock between nextvals
> > in different processes.  Right now it's the buffer lock on the
> > sequence's page.  With a scheme like this, if we just kept doing
> > that, we'd have a single lock covering probably O(100) different
> > sequences which might lead to contention problems.  We could probably
> > improve on that with some thought.
> 
> I was thinking of forcing the rows to be spread to exactly one page per
> sequence...

I was thinking that nextval could grab a shared buffer lock and release
immediately, just to ensure no one holds exclusive buffer lock
concurrently (which would be used for things like dropping one seq tuple
from the page, when a sequence is dropped); then control access to each
sequence tuple using LockDatabaseObject.  This is a HW lock, heavier
than a buffer's LWLock, but it seems better than wasting a full 8kb for
each sequence.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Optimizing aggregates
Следующее
От: Andres Freund
Дата:
Сообщение: Re: pg_sequence catalog