OK, Y’all. If you have been a DBA long enough you have run into situations where you’ve had to import DDL from another database instance and forgotten to remove AUTO_INCREMENT on a table definition. Sometimes this means your auto_increment is way up in the millions and you have 10 rows in the table. People worried about ID depletion on an integer column will do a “facepalm”.
Making matters worse, having perhaps done this on more than one table, sometimes it’s a real pain to detect and fix the issue of auto_increments being much higher than you want them to be across a big number of tables. Sometimes the pain is so great that you might want to simply repeat your data importation.
This quick and dirty “southern fried” script will help you report and rectify that. It detects …[Read more]