mysql 顺序io 全表扫描_mysql优化器在统计全表扫描的代价时的方法

/** InnoDB B-tree index*/typedefstructdict_index_struct dict_index_t;/** Data structure for an index. Most fields will be

initialized to 0, NULL or FALSE in dict_mem_index_create().*/

structdict_index_struct{

index_id_t id;/*!< id of the index*/mem_heap_t* heap; /*!< memory heap*/

const char* name; /*!< index name*/

const char* table_name;/*!< table name*/dict_table_t* table; /*!< back pointer to table*/ //#ifndef UNIV_HOTBACKUP

unsigned space:32;/*!< space where the index tree is placed*/unsigned page:32;/*!< index tree root page number*/

#endif /* !UNIV_HOTBACKUP */unsigned type:DICT_IT_BITS;/*!< index type (DICT_CLUSTERED, DICT_UNIQUE,

DICT_UNIVERSAL, DICT_IBUF, DICT_CORRUPT)*/

#define MAX_KEY_LENGTH_BITS 12unsigned trx_id_offset:MAX_KEY_LENGTH_BITS;/*!< position of the trx id column

in a clustered index record, if the fields

before it are known to be of a fixed size,

0 otherwise*/

#if (1<

be in the index: in the internal

representation we add more columns*/unsigned n_uniq:10;/*!< number of fields from the beginning

which are enough to determine an index

entry uniquely*/unsigned n_def:10;/*!< number of fields defined so far*/unsigned n_fields:10;/*!< number of fields in the index*/unsigned n_nullable:10;/*!< number of nullable fields*/unsigned cached:1;/*!< TRUE if the index object is in the

dictionary cache*/unsigned to_be_dropped:1;/*!< TRUE if this index is marked to be

dropped in ha_innobase::prepare_drop_index(),

otherwise FALSE. Protected by

dict_sys->mutex, dict_operation_lock and

index->lock.*/dict_field_t* fields; /*!< array of field descriptions*/#ifndef UNIV_HOTBACKUP

UT_LIST_NODE_T(dict_index_t)

indexes;/*!< list of indexes of the table*/btr_search_t* search_info; /*!< info used in optimistic searches*/

/*----------------------*/

/** Statistics for query optimization*/

/*@{*/ib_int64_t*stat_n_diff_key_vals;/*!< approximate number of different

key values for this index, for each

n-column prefix where n <=

dict_get_n_unique(index); we

periodically calculate new

estimates*/ib_int64_t*stat_n_non_null_key_vals;/*approximate number of non-null key values

for this index, for each column where

n < dict_get_n_unique(index); This

is used when innodb_stats_method is

"nulls_ignored".*/ulint stat_index_size;/*!< approximate index size in

database pages */

ulint stat_n_leaf_pages;/*!< approximate number of leaf pages in the

index tree */

/*@}*/rw_lock_tlock; /*!< read-write lock protecting the

upper levels of the index tree*/trx_id_t trx_id;/*!< id of the transaction that created this

index, or 0 if the index existed

when InnoDB was started up*/

#endif /* !UNIV_HOTBACKUP */#ifdef UNIV_BLOB_DEBUG

mutex_t blobs_mutex;/*!< mutex protecting blobs*/

void* blobs; /*!< map of (page_no,heap_no,field_no)

to first_blob_page_no; protected by

blobs_mutex; @see btr_blob_dbg_t*/

#endif /* UNIV_BLOB_DEBUG */#ifdef UNIV_DEBUG

ulint magic_n;/*!< magic number*/

/** Value of dict_index_struct::magic_n*/# define DICT_INDEX_MAGIC_N76789786

#endif};

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值