Syntax:
ANALYZE [NO_WRITE_TO_BINLOG | LOCAL]
    TABLE tbl_name [, tbl_name] ...

ANALYZE TABLE performs a key distribution analysis and stores the
distribution for the named table or tables. For MyISAM tables, this
statement is equivalent to using myisamchk --analyze.

This statement requires SELECT and INSERT privileges for the table.

ANALYZE TABLE works with InnoDB, NDB, and MyISAM tables. It does not
work with views.

ANALYZE TABLE is supported for partitioned tables, and you can use
ALTER TABLE ... ANALYZE PARTITION to analyze one or more partitions;
for more information, see [HELP ALTER TABLE], and
https://dev.mysql.com/doc/refman/5.7/en/partitioning-maintenance.html.

During the analysis, the table is locked with a read lock for InnoDB
and MyISAM.

ANALYZE TABLE removes the table from the table definition cache, which
requires a flush lock. If there are long running statements or
transactions still using the table, subsequent statements and
transactions must wait for those operations to finish before the flush
lock is released. Because ANALYZE TABLE itself typically finishes
quickly, it may not be apparent that delayed transactions or statements
involving the same table are due to the remaining flush lock.

By default, the server writes ANALYZE TABLE statements to the binary
log so that they replicate to replicas. To suppress logging, specify
the optional NO_WRITE_TO_BINLOG keyword or its alias LOCAL.

URL: https://dev.mysql.com/doc/refman/5.7/en/analyze-table.html

