Re: Could postgres12 support millions of sequences? (like 10 million)

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Lewis <mlewis(at)entrata(dot)com>, pabloa98 <pabloa98(at)gmail(dot)com>, Rob Sargent <robjsargent(at)gmail(dot)com>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Could postgres12 support millions of sequences? (like 10 million)
Date: 2020-03-20 05:39:50
Message-ID: CAKFQuwYhP6aGnCz9k3pEFrwdk5FbB545Dw8eNTANC+ZNUQJCgg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thursday, March 19, 2020, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Michael Lewis <mlewis(at)entrata(dot)com> writes:
> > On Thu, Mar 19, 2020, 5:48 PM David G. Johnston <
> david(dot)g(dot)johnston(at)gmail(dot)com>
> > wrote:
> >> However, one other consideration with sequences: do you care that
> >> PostgreSQL will cache/pin (i.e., no release) every single sequence you
> >> touch for the lifetime of the session? (I do not think DISCARD matters
> here
> >> but I'm just guessing)
>
> > Would you expand on this point or is there someplace specific in the
> > documentation on this?
>
> I think what David is worried about is that a sequence object is a
> one-row table in PG's implementation. Thus
>
> (1) each sequence requires a dozen or two rows in assorted system
> catalogs (not sure exactly how many offhand).
>

Actually I seemed to have missed that dynamic. I was actually referring to
the SeqTable hash table specified here:

https://github.com/postgres/postgres/blob/85f6b49c2c53fb1e08d918ec9305faac13cf7ad6/src/backend/commands/sequence.c#L69

I wouldn’t think there would be much spreading of data throughout the
catalog if the sequences are unowned (by tables).

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2020-03-20 05:45:50 Re: Could postgres12 support millions of sequences? (like 10 million)
Previous Message pabloa98 2020-03-20 05:31:24 Re: Could postgres12 support millions of sequences? (like 10 million)