Optimizing INFORMATION_SCHEMA Queries VIEW_ROUTINE_USAGE VIEW_TABLE_USAGE Some types of values, even for a non-view  INFORMATION_SCHEMA  table, are retrieved by lookups from the data dictionary. This includes values such as database and table names, table types, and storage engines. Some  INFORMATION_SCHEMA  tables contain columns that provide table statistics: STATISTICS.CARDINALITY TABLES.AUTO_INCREMENT TABLES.AVG_ROW_LENGTH TABLES.CHECKSUM TABLES.CHECK_TIME TABLES.CREATE_TIME TABLES.DATA_FREE TABLES.DATA_LENGTH TABLES.INDEX_LENGTH TABLES.MAX_DATA_LENGTH TABLES.TABLE_ROWS TABLES.UPDATE_TIME Those columns represent dynamic table metadata; that is, information that changes as table contents change. By default, MySQL retrieves cached values for those columns from the  mysql.index_stats  and mysql.table_stats  dictionary tables when the columns are queried, which is more efficient than retrieving statistics directly from the storage engine. If cached statistics are not available or have expired, MySQL retrieves the latest statistics from the storage engine and caches them in the mysql.index_stats  and  mysql.table_stats  dictionary tables. Subsequent queries retrieve the cached statistics until the cached statistics expire. The  information_schema_stats_expiry  session variable defines the period of time before cached statistics expire. The default is 86400 seconds (24 hours), but the time period can be extended to as much as one year. To update cached values at any time for a given table, use  ANALYZE TABLE . Querying statistics columns does not store or update statistics in the  mysql.index_stats  and mysql.table_stats  dictionary tables under these circumstances: •When cached statistics have not expired. •When  information_schema_stats_expiry  is set to 0. •When the server is started in  read_only ,  super_read_only ,  transaction_read_only , or innodb_read_only  mode. •When the query also fetches Performance Schema data. information_schema_stats_expiry  is a session variable, and each client session can define its own expiration value. Statistics that are retrieved from the storage engine and cached by one session are available to other sessions. Note If the  innodb_read_only  system variable is enabled,  ANALYZE TABLE may fail because it cannot update statistics tables in the data dictionary, which use  InnoDB . For  ANALYZE TABLE  operations that update the key distribution, failure may occur even if the operation updates the table itself (for 1709