您好,登錄后才能下訂單哦!
這篇文章給大家分享的是有關MySQL中Innodb表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)); }
感謝各位的閱讀!關于“MySQL中Innodb表Data free怎么計算”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,讓大家可以學到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。