MySQL: optimize column size I need a tool/command which will check a table then say something like that:


columnA use tinyint instead of int
columnB use enum instead of varchar


I've seen something like this while ago so I do know it exists, but search gives nothing or I'm asking it in a wrong way.
This is such a quick and dirty question.

This deserves a quick and dirty answer.

Good News : PROCEDURE ANALYSE()

Bad News : It is Deprecated in 5.7.18 and will not be available in MySQL 8.0

I have discussed  PROCEDURE ANALYSE() over the years: See my old posts.

In your case, you would just do this:

SELECT columnA,columnB FROM yourtable PROCEDURE ANALYSE();


and the output will tell you the min value, max value, avg value, and recommended datatype.