2

After performing a major version upgrade of a PostgreSQL database, the ANALYZE command needs to be run in order to repopulate tables for query statistics, which do not persist through the upgrade. Until the stats tables are repopulated, query performance can be severely degraded.

Do the statistics tables for MySQL databases using the InnoDB engine persist through major version upgrades?

Do you need to run ANALYZE or a similar command after a major version upgrade in order to improve performance?

2 Answers 2

2

As of about 5.6, the "statistics" have been reasonably well maintained. Every query starts by collecting statistics if needed.

MySQL comes close to making "statistics" a no-brainer. Just run your queries; it will almost always "do a good job".

Any statistics that are persisted are kept with the data.

3

Regardless of whether they persist or not, it is always a good idea to update statistics after a major version upgrade (of any database, not just MySQL). The structure of system tables and views might change; there may be additional metrics collected by the new version; there may be bug fixes in the statistics analyzer; there may be changes in the physical implementation of various database objects that require updated statistics.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.