Update table statistics (ANALYZE TABLE)
MySQLMaintenanceCommand
ANALYZE TABLE customer;What it does
Recomputes the table's index/key distribution statistics so the optimizer can choose better plans.
When to use it
When bad query plans appear after bulk data changes.
Caution
A brief metadata lock is taken on the table while it runs. On InnoDB it is sample-based; increase innodb_stats_persistent_sample_pages for more accuracy.