ANALYZE (MySQL)
ANALYZE (MySQL) is a SQL statement in the MySQL Specific category. MySQL: updates index distribution statistics. Essential after large data changes to help the optimizer. The syntax is ANALYZE TABLE table_name;. It returns table analyzed. A typical example: ANALYZE TABLE employees; -- Updates cardinality estimates ANALYZE TABLE employees, departments; -- Multiple tables -- InnoDB: persistent statistics by default -- Use WITH HISTOGRAM for detailed column stats: ANALYZE TABLE employees UPDATE HISTOGRAM ON salary, age WITH 100 BUCKETS; A close relative is AUTO_INCREMENT, which mySQL auto-generates sequential integer values for this column. Commonly used with PRIMARY KEY. A close relative is ENGINE, which specifies the MySQL storage engine. InnoDB (default) supports transactions and foreign keys. MyISAM is faster for read-heavy. A close relative is LAST_INSERT_ID(), which returns the AUTO_INCREMENT value generated by the most recent INSERT in the current connection. More about this category: MySQL-specific features — AUTO_INCREMENT, ENGINE, SHOW TABLES, LIMIT.