Documentation Home
MySQL Internals Manual Implementing the info() Method

The optimizer requests an update of table information by calling the [custom-engine.html#custom-engine-api-reference-info handler::info()] method. The info() method does not have a return value, instead it is expected that the storage engine will set a variety of public variables that the server will then read as needed. These values are also used to populate certain SHOW outputs such as SHOW TABLE STATUS and for queries of the INFORMATION_SCHEMA.

All variables are optional but should be filled if possible:

  • records - The number of rows in the table. If you cannot provide an accurate number quickly you should set the value to be greater than 1 so that the optimizer does not perform optimizations for zero or one row tables.

  • deleted - Number of deleted rows in table. Used to identify table fragmentation, where applicable.

  • data_file_length - Size of the data file, in bytes. Helps optimizer calculate the cost of reads.

  • index_file_length - Size of the index file, in bytes. Helps optimizer calculate the cost of reads.

  • mean_rec_length - Average length of a single row, in bytes.

  • scan_time - Cost in I/O seeks to perform a full table scan.

  • delete_length -

  • check_time -

When calculating values, speed is more important than accuracy, as there is no sense in taking a long time to give the optimizer clues as to what approach may be the fastest. Estimates within an order of magnitude are usually good enough.