Re: Why hash OIDs?

Поиск
Список
Период
Сортировка
От Thomas Munro
Тема Re: Why hash OIDs?
Дата
Msg-id CAEepm=3X3EFQXKfbbVTZPRmPhrixd7TPK89R6sQKztegM=z6ow@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Why hash OIDs?  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: Why hash OIDs?
Список pgsql-hackers
On Wed, Aug 29, 2018 at 2:09 AM Robert Haas <robertmhaas@gmail.com> wrote:
> On Mon, Aug 27, 2018 at 10:12 PM, Andres Freund <andres@anarazel.de> wrote:
> > Huh? Oids between, say, 1 and FirstNormalObjectId, are vastly more
> > common than the rest. And even after that, individual tables get large
> > clusters of sequential values to the global oid counter.
>
> Sure, but if you get a large cluster of sequential values, a straight
> mod-N bucket mapping works just fine.   I think the bigger problem is
> that you might get a large cluster of values separated by exactly a
> power of 2.  For instance, say you have one serial column and one
> index:
>
> rhaas=# create table a (x serial primary key);
> CREATE TABLE
> rhaas=# create table b (x serial primary key);
> CREATE TABLE
> rhaas=# select 'a'::regclass::oid, 'b'::regclass::oid;
>   oid  |  oid
> -------+-------
>  16422 | 16430
> (1 row)
>
> If you have a lot of tables like that, bad things are going to happen
> to your hash table.

Right.  I suppose that might happen accidentally when creating a lot
of partitions.

Advance the OID generator by some prime number after every CREATE TABLE?

/me ducks

-- 
Thomas Munro
http://www.enterprisedb.com


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

Предыдущее
От: Thomas Munro
Дата:
Сообщение: Re: Why hash OIDs?
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Postmaster doesn't send SIGTERM to bgworker during fast shutdownwhen pmState == PM_STARTUP