the info () function is called before the table scan operation is performed to provide additional information for the optimizer.
The information required by the optimizer is not given by the return value, you need to populate the specific properties of the storage engine class, and when the info () call returns, the optimizer reads the storage engine class.
In addition to being used by the optimizer, many collection of values will also be used for the show TABLE status statement during the call to the info () function.
The complete public properties are listed in Sql/handler.h, and some common properties are given below:
ulonglong data_file_length;
/* Length off data file */
ulonglong max_data_file_length;
/* Length off data file */
ulonglong index_file_length;
ulonglong max_index_file_length;
ulonglong delete_length;
/* Free bytes */
ulonglong auto_increment_value;
ha_rows records;
/* Records in table */
ha_rows deleted;
/* Deleted records */
ulong raid_chunksize;
ulong mean_rec_length;
/* physical reclength */
time_t create_time;
/* When table was created */
time_t check_time;
time_t update_time;
For table scans, the most important attribute is "records", which indicates the number of records in the table. When the storage engine indicates that there are 0 or 1 rows in the table, or more than 2 rows, the optimizer executes differently in both cases. Therefore, it is important to return a value greater than or equal to 2 when you do not know how many rows are in the table before you perform a table scan (for example, the data is externally populated).