Fieldtop looks at all fields in all tables and all databases and analyzes how close the values in each field are to the maximum (or minimum) allowed value for the given field type. This can give you interesting insight into your databases. A typical output looks like this:
This would tell you a couple of things at a glance:
- Your user IDs use 30% of the available range. Depending on how long the project has been running, this can be ok or could mean your field is in danger of overflowing at some point.
- Some user names already use the maximum length. This is probably ok if your database design is in sync with your application.
- The negative values in the user karma column are already pretty big. Maybe you did not expect that people aquire negative karma so fast?
- The IDs for posts are far from the limit
- The text field for the posts is already maxing out the max lenght. Maybe that is not what you want.
The output can be escpecially interesting for databases that have been used for extended periods of time. Often at some point, some of the data will outgrow the designated data types.
In fact, the idea to make this tool came up when no-gravity noticed that after 10 years of unsupervised learning, his music recommendation system Gnoosic maxed out over 50% of the available range for band popularity. The popularity was stored in a signed integer which can hold numbers up to 2 billion. And Pink Floyd was already at 1.3 billion. So the popularity field was destined to overflow at some point in the future.
FieldTop has been developed and tested using MySQL 5.5.49 and PHP 5.5.9 and is expected to work on PHP >= 5.5.9
You are welcome to send pull requests with enhancements or fixes to this project.
Please report any bugs in the issue tracker.