MySQL not updating information_schema, unless I manually run ANALYZE TABLE `myTable`
问题 I have the need to get last id (primary key) of a table (InnoDB), and to do so I perform the following query: SELECT (SELECT `AUTO_INCREMENT` FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = 'mySchema' AND `TABLE_NAME` = 'myTable') - 1; which returns the wrong AUTO_INCREMENT. The problem is the TABLES table of information_schema is not updated with the current value, unless I run the following query: ANALYZE TABLE `myTable`; Why doesn't MySQL update information_schema automatically,