pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Michael Lewis <mlewis@entrata.com>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: pabloa98 <pabloa98@gmail.com>
Cc: Rob Sargent <robjsargent@gmail.com>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Could postgres12 support millions of sequences? (like 10 million)
Date: Thu, 19 Mar 2020 21:12:30 -0700
Message-ID: <c66c1fc7-a53b-be8a-81b4-2ab55c1b7b03@aklaver.com> (raw)
In-Reply-To: <CAHOFxGqsZJM5s9x3ELVtq_qRQj1odZ_L-SNKqdYyyBbd=1+_nw@mail.gmail.com>
References: <CAEjudX5UdEYJwSTYir07rUX10u3AdEyht_K=GWk_CyOChSFguQ@mail.gmail.com>
	<B6FC3723-FF9D-4E5E-8506-3BF9421825DF@gmail.com>
	<CAEjudX5T5E_two14i_i19uGMkSs_mT4JG4hhXWoY3Z5M+GaXRQ@mail.gmail.com>
	<7CF69CD4-AE4A-4C2B-9621-4462B4AE1726@gmail.com>
	<CAEjudX5=jxdxZmuSXgBCM+nHNhR=0OAcZGB5UaRB1JZe1YRNtA@mail.gmail.com>
	<CAKFQuwZ==ri5_m2geFA-GPOdfnVggmJRu3zEi+1EwJdJA=9AeQ@mail.gmail.com>
	<CAHOFxGqsZJM5s9x3ELVtq_qRQj1odZ_L-SNKqdYyyBbd=1+_nw@mail.gmail.com>

On 3/19/20 7:38 PM, Michael Lewis wrote:
> 
> 
> On Thu, Mar 19, 2020, 5:48 PM David G. Johnston 
> <david.g.johnston@gmail.com <mailto:david.g.johnston@gmail.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?
> 

See the section starting here:

https://www.postgresql.org/docs/12/sql-createsequence.html

Notes

"Unexpected results might be obtained if a cache setting greater than 
one is used for a sequence object that will be used concurrently by 
multiple sessions. Each session will allocate and cache successive 
sequence values during one access to the sequence object and increase 
the sequence object's last_value accordingly. Then, the next cache-1 
uses of nextval within that session simply return the preallocated 
values without touching the sequence object. So, any numbers allocated 
but not used within a session will be lost when that session ends, 
resulting in “holes” in the sequence.

...
"


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (58+ messages)  latest in thread

Message-ID: <c66c1fc7-a53b-be8a-81b4-2ab55c1b7b03@aklaver.com>
Permalink:  ../c66c1fc7-a53b-be8a-81b4-2ab55c1b7b03@aklaver.com/
Also on:    postgresql.org/message-id/c66c1fc7-a53b-be8a-81b4-2ab55c1b7b03@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, mlewis@entrata.com, david.g.johnston@gmail.com, pabloa98@gmail.com, robjsargent@gmail.com
  Subject: Re: Could postgres12 support millions of sequences? (like 10 million)
  In-Reply-To: <c66c1fc7-a53b-be8a-81b4-2ab55c1b7b03@aklaver.com>
  References: <CAEjudX5UdEYJwSTYir07rUX10u3AdEyht_K=GWk_CyOChSFguQ@mail.gmail.com> <B6FC3723-FF9D-4E5E-8506-3BF9421825DF@gmail.com> <CAEjudX5T5E_two14i_i19uGMkSs_mT4JG4hhXWoY3Z5M+GaXRQ@mail.gmail.com> <7CF69CD4-AE4A-4C2B-9621-4462B4AE1726@gmail.com> <CAEjudX5=jxdxZmuSXgBCM+nHNhR=0OAcZGB5UaRB1JZe1YRNtA@mail.gmail.com> <CAKFQuwZ==ri5_m2geFA-GPOdfnVggmJRu3zEi+1EwJdJA=9AeQ@mail.gmail.com> <CAHOFxGqsZJM5s9x3ELVtq_qRQj1odZ_L-SNKqdYyyBbd=1+_nw@mail.gmail.com> <c66c1fc7-a53b-be8a-81b4-2ab55c1b7b03@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox