Re: (2^63 - 1)::bigint => out of range? (because of the doubleprecision)

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: (2^63 - 1)::bigint => out of range? (because of the doubleprecision)
Дата
Msg-id 452406d5-fc36-f62e-1675-bf7773e2657b@aklaver.com
обсуждение исходный текст
Ответ на Re: (2^63 - 1)::bigint => out of range? (because of the double precision)  (Alexey Dokuchaev <danfe@nsu.ru>)
Ответы Re: (2^63 - 1)::bigint => out of range? (because of the double precision)
Список pgsql-general
On 06/09/2018 05:24 AM, Alexey Dokuchaev wrote:
> On Fri, Jun 08, 2018 at 10:30:45AM -0700, Adrian Klaver wrote:

>>
>> My guess is because sequences are often used to provide numbers for a
>> PRIMARY KEY and NO CYCLE is a heads up for key duplication before the
>> PK code kicks in.
> 
> 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. 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

> 
> ./danfe
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com


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

Предыдущее
От: Andreas Kretschmer
Дата:
Сообщение: Re: Performance problem postgresql 9.5
Следующее
От: Alexey Dokuchaev
Дата:
Сообщение: Re: (2^63 - 1)::bigint => out of range? (because of the double precision)