Re: (2^63 - 1)::bigint => out of range? (because of the double precision) - Mailing list pgsql-general

From Alexey Dokuchaev
Subject Re: (2^63 - 1)::bigint => out of range? (because of the double precision)
Date
Msg-id 20180609153626.GA15452@regency.nsu.ru
Whole thread Raw
In response to Re: (2^63 - 1)::bigint => out of range? (because of the doubleprecision)  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-general
On Sat, Jun 09, 2018 at 07:20:17AM -0700, Adrian Klaver wrote:
> On 06/09/2018 05:24 AM, Alexey Dokuchaev wrote:
> >OK, but what about highly volatile tables for come-and-go type of things?
> >Think of a session pool, or task queue.  I want to use NO CYCLE for this
> >kind of tables as it would allow me to never worry about hitting "nextval:
> >reached maximum value of sequence" error, recycle ids (because they come
> >and go), and still be safe because PK constraint protects me.  Any flaws
> >in this vision of mine?
> 
> Assuming you meant CYCLE not NO CYCLE, I see no issue.

Oh, mea culpa, I meant CYCLE of course (in the quoted paragraph above).

> If you do use a sequence with NO CYCLE you can use ALTER SEQUENCE some_seq
> RESTART to reset it:
> https://www.postgresql.org/docs/10/static/sql-altersequence.html

I understand that I can reset it; the idea was to minimize the table and
sequence maintenance while allowing it to work, well, forever.  Hence the
CYCLE idea.  Anyway, I've heard you, thanks Adrian.

./danfe


pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: (2^63 - 1)::bigint => out of range? (because of the doubleprecision)
Next
From: Maksim Milyutin
Date:
Subject: Re: Slow planning time for simple query