MySQL:Innodb表 Data free 的計算概要
簡單記錄一下,因為看了一下Data free的計算還算準確。不是統計值
大概是空閒extent的大小。
ST_FIELD_INFO tables_fields_info[]= {... {"DATA_FREE", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Data_free", OPEN_FULL_TABLE}, ... } tables_fields_info[12]就是Data_free
ST_SCHEMA_TABLE schema_tables[]= {... {"TABLES", tables_fields_info, create_schema_table, get_all_tables, make_old_format, get_schema_tables_record, 1, 2, 0, OPTIMIZE_I_S_TABLE}, ... } 填充方式get_schema_tables_record函式
其中有一句 table->field[12]->store((longlong) file->stats.delete_length, TRUE); 實際就是 file->stats.delete_length
其中 file->stats.delete_length呼叫進行取值
ha_innobase::info_low 其中包含 avail_space = fsp_get_available_space_in_free_extents(ib_table->space); stats.delete_length = avail_space * 1024;
uintmax_tfsp_get_available_space_in_free_extents( const fil_space_t* space) { ut_ad(space->n_pending_ops > 0); ulint size_in_header = space->size_in_header;//總的頁面大小 if (size_in_header < FSP_EXTENT_SIZE) { //碎片頁 直接返回0 return(0); /* TODO: count free frag pages and return a value based on that */ } /* Below we play safe when counting free extents above the free limit: some of them will contain extent descriptor pages, and therefore will not be free extents */ ut_ad(size_in_header >= space->free_limit); ulint n_free_up = (size_in_header - space->free_limit) / FSP_EXTENT_SIZE; //(總的頁面大小-已經初始化大小)/EXTENT SIZE page_size_t page_size(space->flags); if (n_free_up > 0) { n_free_up--; n_free_up -= n_free_up / (page_size.physical() / FSP_EXTENT_SIZE); //減去extent管理塊? } /* We reserve 1 extent + 0.5 % of the space size to undo logs and 1 extent + 0.5 % to cleaning operations; NOTE: this source code is duplicated in the function above! */ ulint reserve = 2 + ((size_in_header / FSP_EXTENT_SIZE) * 2) / 200; ulint n_free = space->free_len + n_free_up; if (reserve > n_free) { return(0); } return(static_cast<uintmax_t>(n_free - reserve) * FSP_EXTENT_SIZE * (page_size.physical() / 1024)); }
作者微信:gp_22389860
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7728585/viewspace-2638387/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL的 data_free,表碎片整理MySql
- MYSQL INNODB 如何計算B+樹表的最大容量和行數MySql
- MySQL中Innodb如何計算索引的統計資訊?MySql索引
- MySQL InnoDB表的限制MySql
- MySQL 索引設計概要MySql索引
- [MySQL5.6]Innodb新的監控表INNODB_METRICSMySql
- MySQL InnoDB表空間加密MySql加密
- 恢復MySQL InnoDB表結構的方法MySql
- MySQL InnoDB Undo表空間配置MySql
- MySQL 5.7 查詢InnoDB鎖表MySql
- MySQL啟動報錯InnoDB: The innodb_system data file './ibdata1' is of a differentMySql
- MYSQL INNODB中hash查詢表的實現MySql
- MySQL InnoDB臨時表空間配置MySql
- MySQL 減少InnoDB系統表空間的大小MySql
- MySQL innodb表使用表空間物理檔案複製表MySql
- mysql 5.6效能監控表innodb_metricsMySql
- MySQL 增加InnoDB系統表空間大小MySql
- MySQL InnoDB File-Per-Table表空間MySql
- MySQL InnoDB表--BTree基本資料結構MySql資料結構
- MySQL 5.5 InnoDB表鎖行鎖測試MySql
- MySQL InnoDB 共享表空間和獨立表空間MySql
- MySQL InnoDB 共享表空間和獨立表空間MySql
- 批量修改Mysql資料庫表Innodb為MyISANMySql資料庫
- mysql innodb 索引失效問題引起表級鎖MySql索引
- 計算innodb_buffer_pool使用率
- mysql innodb的行鎖MySql
- MySQL:一段innodb buffer instance和cleaner執行緒計算邏輯MySql執行緒
- MySQL innodb_table_stats表不存在的解決方法MySql
- 高效能分散式計算與儲存系統設計概要分散式
- 初觸hibernate01--MYSQL建表時type=InnoDB和Engine=InnoDB注意點MySql
- MySQL 建表DATA DIRECTORY 、INDEX DIRECTORY 簡介MySqlIndex
- MySQL InnoDB 索引MySql索引
- mysql錯誤: [ERROR] InnoDB: auto-extending data file /data/ibdata1 is of a different size 768 pages...MySqlError
- MySQL的show engine innodb statusMySql
- mysql innodb的行鎖(2)MySql
- mysql innodb的行鎖(3)MySql
- mysql innodb的行鎖(4)MySql
- 探索MySQL的InnoDB索引失效MySql索引