We need a php script which
1. Will visit all the tables in a given mysql database.
2. It will check all the primary keys to make sure none of them are close to the limit.
For instance unsigned smallint for mysql can be at most 255. So for a table which has a primary key of type smallint, you'll need to check if the max value used so far is close to the limit, 255.
We can define closeness 20% of the maximum.
The script will need to output the names of the tables which are close to exhausting their primary key limits.