Search code examples
mysqlsqlauto-increment

Auto Increment Primary Key Integrity


I have a table with a post column and an auto incrementing id column. My id column is set as primary key. Is it bad practice to delete certain posts causing the id column to become unorganized?


Solution

  • A primary key is only for uniquely identifying a record. If you need specific order of your records then use an extra column for that. For instance a datetime column.