如何掌握MySQL中實施info()函數

來源:互聯網
上載者:User

  執行表掃描操作之前,將調用info()函數,以便為最佳化程式提供額外資訊。

  最佳化程式所需的資訊不是通過傳回值給定的,你需填充儲存引擎類的特定屬性,當info()調用返回後,最佳化程式將讀取儲存引擎類。

  除了供最佳化程式使用外,在調用info()函數期間,很多值集合還將用於SHOW TABLE STATUS語句。

  在sql/handler.h中列出了完整的公用屬性,下面給出了一些常見的屬性:

  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的值,這很重要(例如,資料是在外部填充的)。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.