1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[SQL] Fixing holes/gaps in numbers generated by Postgres sequence

Discussão em 'Outras Linguagens' iniciado por Stack, Outubro 3, 2024 às 19:33.

  1. Stack

    Stack Membro Participativo

    I have a postgres database that uses sequences extensively to generate primary keys of tables. After a lot of usage of this database i.e. Adding/Update/Delete operation the columns that uses sequences for primary keys now have a lot holes/gaps in them and the sequence value itself is very high.

    My question is: Are there any ways in which we can fix these gaps in Primary Keys? which should in turn bring down the max value of the number in theseprim columns and then reset the sequence?

    Note: A lot of these columns are also referenced by other columns as ForeignKeys.

    Continue reading...

Compartilhe esta Página