Documentation Home
MySQL Internals Manual
Download this Manual
EPUB - 0.8Mb

22.18.17 info


Prompts storage engine to report statistics.


virtual int info (



flag ;


This is the info method.

info() is used to return information to the optimizer. Currently, this table handler doesn't implement most of the fields really needed. SHOW also makes use of this data Another note, you will probably want to have the following in your code:

if (records < 2) records = 2

The reason is that the server will optimize for cases of only a single record. If in a table scan you don't know the number of records it will probably be better to set records to two so you can return as many records as you need. Along with records a few more variables you may wish to set are: records deleted data_file_length index_file_length delete_length check_time See public variables in handler.h for more information.

Called in:


  • flag

Return Values

0 for if no error occurred, HA_ERR_xxx if an error occurred.


This example is from the CSV storage engine:

int ha_tina::info(uint flag)
  /* This is a lie, but you don't want the optimizer to see zero or 1 */
  if (!records_is_known && stats.records < 2)
    stats.records= 2;

Download this Manual
EPUB - 0.8Mb
User Comments
Sign Up Login You must be logged in to post a comment.