I'm interested in this for InnoDB mostly, but also for MyISAM.
I looked around in information_schema and did not see this data anywhere.
I'm using MySQL 5.5.16.
I'm interested in this for InnoDB mostly, but also for MyISAM.
I looked around in information_schema and did not see this data anywhere.
I'm using MySQL 5.5.16.
There is no immediate control data to tell you that, but there are a few mechanisms you can setup.
If you have binary logging enabled, simply do a grep -i "analyze table" against all the binary logs using the output from mysqlbinlog.
If you have the general log enabled, simply do a grep -i "analyze table" against the general log file and locate the timestamp just about the command.
You should schedule a cronjob that runs ANALYZE TABLE against all tables that have high-write, high-update, high-delete volume. That way, there is no guess work.
Try setting innodb_stats_on_metadata to have a measure of predictability as to when an InnoDB table needs ANALYZE TABLE. (See my Mar 26, 2012 post :
When are InnoDB table index statistics updated? )
In the past, I have often stated that running ANALYZE TABLE table against InnoDB is useless.
Jun 21, 2011 : From where does the MySQL Query Optimizer read index statistics?Aug 04, 2011 : Optimizing InnoDB default settingsOct 16, 2011 : Suddenly have to rebuild indexes to prevent site from going downHopefully, MECHANISM #4 is probably what you need.
innodb_stats_on_metadatain order to improve the performance of information_schema. – Ike Walker Jan 04 '13 at 20:05information_schema.STATISTICScould possibly be more stabilized byinnodb_stats_on_metadata. – RolandoMySQLDBA Jan 04 '13 at 21:00innodb_stats_on_metadata. I'll accept your answer now as it's clear that there is no easy way to get this data form MySQL. – Ike Walker Jan 04 '13 at 22:22ANALYZE TABLEon a regular basis. Most will run it once, let hundreds of thousands of INSERTs, UPDATEs, and DELETEs go by, and forget to runANALYZE TABLEagain. This will make the MySQL Query Optimizer take bad guesses on EXPLAIN plans. If you crontab yourANALYZE TABLE, then it is useful (as I stated inMECHANISM #3). – RolandoMySQLDBA Mar 05 '15 at 17:51