ITPub博客

首页 > Linux操作系统 > Linux操作系统 > MySQL数据库用调用info()函数

MySQL数据库用调用info()函数

原创 Linux操作系统 作者:mysql_itpub 时间:2008-07-28 13:02:25 0 删除 编辑

MySQL数据库用调用info()函数...phpma.com

执行表扫描操作之前,将调用info()函数,以便为优化程序提供额外信息。phpma.com

        优化程序所需的信息不是通过返回值给定的,你需填充存储引擎类的特定属性,当info()调用返回后,优化程序将读取存储引擎类。

除了供优化程序使用外,在调用info()函数期间,很多值集合还将用于SHOW TABLE STATUS语句。

在sql/handler.h中列出了完整的公共属性,下面给出了一些常见的属性:phpma.com

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;

对于表扫描,最重要的属性是“records”,它指明了表中的记录数。当存储引擎指明表中有0或1行时,或有2行以上时,在这两种情况下,优化程序的执行方式不同。因此,当你在执行表扫描之前不清楚表中有多少行时,应返回大于等于2的值,这很重要(例如,数据是在外部填充的)。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/14884316/viewspace-410871/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: MySQL Join详解
请登录后发表评论 登录
全部评论

注册时间:2008-07-17

  • 博文量
    184
  • 访问量
    170442