Is there a way to determine whether a table, a very large table possibly, has contiguous / consecutive auto increment primary key IDs? Is there a SQL query way to determine this? Suppose someone deletes some rows randomly from a very large table. I need to know that this has happened.
e.g.
table XYZ
id
1
2
3
4
table abc
1
2
4 <--- non contiguous, skipped 3
5
Curious about data integrity. I want a SQL query methodology way in order to just keep things simple and not have to write a PHP script to run against the database.
You could compare these two values:
If the table is still contiguous they will be the same.