您好,登錄后才能下訂單哦!
這篇文章給大家分享的是有關(guān)MySQL中Innodb表Data free怎么計(jì)算的內(nèi)容。小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,一起跟隨小編過(guò)來(lái)看看吧。
大概是空閑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函數(shù)
其中有一句 table->field[12]->store((longlong) file->stats.delete_length, TRUE); 實(shí)際就是 file->stats.delete_length
其中 file->stats.delete_length調(diào)用進(jìn)行取值
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;//總的頁(yè)面大小 if (size_in_header < FSP_EXTENT_SIZE) { //碎片頁(yè) 直接返回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; //(總的頁(yè)面大小-已經(jīng)初始化大小)/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)); }
感謝各位的閱讀!關(guān)于“MySQL中Innodb表Data free怎么計(jì)算”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,讓大家可以學(xué)到更多知識(shí),如果覺(jué)得文章不錯(cuò),可以把它分享出去讓更多的人看到吧!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。