Do numerical primary keys of deleted records in a database get reused for future new records?
For example if I have an auto-numbered field, I add new records without specifying this field and let DB engine to pick it for me. So, will it pick the number of the deleted record? If yes, when? // SQL Server, MySQL. // Follow-up question: What happens when DB engine runs out of numbers to use for primary keys? NO. numerical primary keys will not reused, except you specify them manually(you should really avoid this!) AFAIK, this could happen in MySQL: How AUTO_INCREMENT Handling Works in InnoDB : InnoDB uses the in-memory auto-increment counter as long as the server runs. When the server is