在mysql存储引擎查询函数_Innodb存储引擎查询输出分析

do_select():

查询入口函数。

|

sub_select():

查询部分join的记录。循环调用ha_innobase::rnd_next()和evaluate_join_record()获取并处理该部分的每条记录。(sql\sql_select.cc:11705)

|

| evaluate_join_record():

处理一条查询记录。(sql\sql_select.cc:11758)

|

|

rr_sequential():调用ha_innobase::rnd_next()读取下一条记录。(sql\records.cc:452)

|

| | ha_innobase::rnd_next():

读取下一条记录。(storage\innobase\handler\ha_innodb.cc:6141)

|

| | | ha_innobase::general_fetch():

从给定的索引位置获取下一条或上一条记录。(storage\innobase\handler\ha_innodb.cc:5948)

|

| | | | row_search_for_mysql():

从数据库中查询一条记录。以下分为6个阶段分别处理各个部分。(storage\innobase\row\row0sel.c:3369)

|

| | | | | 第一阶段:释放自适应hash索引的锁。

|

| | | | | |

rw_lock_get_writer()函数用于获取读写锁。如果获取失败,释放目前的读写锁。(storage\innobase\include\sync0rw.ic:122)

|

| | | | | 第二阶段:从预读的cache中获取记录。

|

| | | | | |

row_sel_pop_cached_row_for_mysql():函数用于从cache中读取一行记录,(storage\innobase\row\row0sel.c:3167)

|

| | | | | | | row_sel_copy_cached_field_for_mysql():

函数读取每个字段。(storage\innobase\row\row0sel.c:3134)

|

| | | | | 第三阶段:使用自适应hash索引快速查找。

|

| | | | | |

row_sel_try_search_shortcut_for_mysql()函数使用hash索引获取聚集索引的记录。(storage\innobase\row\row0sel.c:3293)

|

| | | | | | |

row_sel_store_mysql_rec()函数将获取的innobase格式的行记录转化为mysql格式。(storage\innobase\row\row0sel.c:2692)

|

| | | | | | | |

row_sel_field_store_in_mysql_format()函数将innobase格式的行记录中的每个字段转化为mysql格式。(storage\innobase\row\row0sel.c:2535)

|

| | | | | 第四阶段:打开并恢复索引的游标位置。

|

| | | | | | sel_restore_position_for_mysql():

恢复索引的游标位置。(storage\innobase\row\row0sel.c:3070)

|

| | | | | | | btr_pcur_restore_position_func():

恢复一个持久化游标的位置。(storage\innobase\btr\btr0pcur.c:208)

|

| | | | | | | | btr_cur_get_index():

获取索引。(storage\innobase\include\btr0pcur.ic:51)

|

| | | | | | | | buf_page_optimistic_get():

|

| | | | | | | | btr_pcur_get_rec():

获取持久化游标的记录。(storage\innobase\include\btr0pcur.ic:104)

|

| | | | | | | | | btr_cur_get_rec ():

获取当前游标位置的记录。(storage\innobase\include\btr0pcur.ic:104)

|

| | | | | | | | rec_get_offsets_func():

获取记录中每个字段的偏移。(storage\innobase\rem\rem0rec.c:524)

|

| | | | | | | btr_pcur_move_to_next():

移动持久化游标到下一条记录。(storage\innobase\include\btr0pcur.ic:342)

|

| | | | | 第五阶段:查找匹配的记录。

|

| | | | | | page_rec_is_infimum():

查看当前记录是否是该页的infinum记录。infinum记录表示比任何键值都小的记录。(storage\innobase\include\page0page.ic:415)

|

| | | | | | page_rec_is_supermum():

查看当前记录是否是该页的supermum记录。supermum记录表示比任何键值都大的记录。(storage\innobase\include\page0page.ic:403)

|

| | | | | | rec_get_next_offs():

获取相同页中下一条记录的偏移量。(storage\innobase\include\rem0rec.ic:325)

|

| | | | | | rec_get_offsets_func():

获取记录中每个字段的偏移。(storage\innobase\rem\rem0rec.c:524)

|

| | | | | |

rec_offs_validate():验证记录的偏移量。(storage\innobase\rem\rem0rec.c:954)

|

| | | | | |

row_sel_store_mysql_rec()函数将获取的innobase格式的行记录转化为mysql格式。(storage\innobase\row\row0sel.c:2692)

|

| | | | | | |

row_sel_field_store_in_mysql_format()函数将innobase格式的行记录中的每个字段转化为mysql格式。(storage\innobase\row\row0sel.c:2535)

|

| | | | | | | btr_pcur_store_position():

存储游标的位置。(storage\innobase\btr\btr0pcur.c:89)

|

| | | | | | | | btr_pcur_get_block():

获取持久化游标的缓冲块。(storage\innobase\include\btr0pcur.ic:90)

|

| | | | | | | | btr_pcur_get_page_cur():

获取持久化游标的页的游标。(storage\innobase\include\btr0pcur.ic:64)

|

| | | | | | | | page_cur_get_rec():

获取游标位置的记录。(storage\innobase\include\page0cur.ic:76)

|

| | | | | | | | dict_index_copy_rec_order_prefix():

拷贝记录。(storage\innobase\dict\dict0dict.c:4185)

|

| | | | | | | | | rec_copy_prefix_to_buf():

拷贝记录的字段到缓存buffer中。(storage\innobase\rem\rem0rec.c:1383)

|

| | | | | | | | | dict_index_get_nth_field():

获取第n个字段的起始地址。(storage\innobase\include\dict0dict.ic:620)

|

| | | | | | | | | dict_field_get_col():

获取第n个字段的值。(storage\innobase\include\dict0dict.ic:663)

|

| | | | | 第六阶段:移动游标到下一个索引记录。

|

| | | | | | btr_pcur_move_to_next():

移动持久化游标到下一条记录。(storage\innobase\include\btr0pcur.ic:342)

|

| | | | | | mtr_commit():

提交事务。(storage\innobase\mtr\mtr0mtr.c:247)

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值