❔ Auto incremented Id not sequential
Hello, I have an auto increment on an Id(integer) column on a database, however values are not sequential. The gaps aren't caused by deletion, as we have no functionality for it on our website( unless someone is intentionally deleting them by hand :p ).
For example, these are the Id's for the first 22 records from the db:
Is this something to worry about? I'm using EF core.
8 Replies
Just realized most of these are incrementing by 33, however there are a few exceptions
What database software? Is it perhaps using HiLo?
in MSSQL, its possible to tell a table to use a certain sequence to get its IDs from, and a sequence could easily be configured to have an increment of 33
I'm using Postgres db and looking at the sequence, nothing seems to be out of the ordinary( it was auto generated by ef). The issue seems to be with this table only as well.
But there is a sequence specifically for this table?
Yes.
Alright, my postgres isn't amazing, but if you were to check
currval
and nextval
on that, (use a transaction and roll it back!), what do you get
https://www.postgresql.org/docs/current/functions-sequence.htmlSorry for the late response, discord isn't showing me notifications for some reason. Nextval incremented the value by 1 each time I called it
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.