How to grasp the implementation of info () function in MySQL

Source: Internet
Author: User

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 is 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).

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.