Re: Why hash OIDs?

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why hash OIDs?
Date: 2018-08-28 23:45:32
Message-ID: CAEepm=1yuCKJ9MFZzUjPcykjP6q9OqsjjO7pEmLiGezrmM1XMA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Aug 29, 2018 at 11:05 AM Thomas Munro
<thomas(dot)munro(at)enterprisedb(dot)com> wrote:
> On Wed, Aug 29, 2018 at 2:09 AM Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> > 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

Erm, s/prime/random/. Or use a different OID generator for each
catalogue so that attributes etc don't create gaps in pg_class OIDs.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-08-29 00:02:42 Re: Why hash OIDs?
Previous Message Michael Paquier 2018-08-28 23:24:12 Re: Postmaster doesn't send SIGTERM to bgworker during fast shutdown when pmState == PM_STARTUP