C#C
C#3y ago
Triufelis

✅ gaps in database keys

I don't know if this is the best place to post it as it is more related to databases. However.

I am currently learning Razor Pages, and trying to work with databases for the first time. I went with PostgreSQL. I did all the CRUD operations. And i went with the auto-incrementing property on my key, so the database deals with it. However if i delete elements the key value doesn't reset and there are gaps.

My first question would be. Are these gaps in the key values acceptable or should i deal with them somehow?

My second question is. PostgreSQL offers the ability tu TRUNCATE the data. Which resets the key values and starts from 1 again. Would it be a wise thing to do if i truncate it if the database is empty so the values start back from one?

Basically, to put it in short. Do i do anything about the gaps in the database key values or just leave as is?
Was this page helpful?