Handler_read_first Handler_read_first表示执行全表扫描时读取的第一条记录的次数。如果这个值很高,可能意味着数据库经常需要进行全表扫描,这通常是由于缺乏适当的索引导致的。为了优化性能,可以考虑为经常用于查询条件的列添加索引。 Handler_read_key Handler_read_key表示通过索引读取记录的次数。这是一个非常重要的...
Handler_read_key + 1 : 根据第一个位置的KEY读1行 Handler_read_next + 9 : 按(主)键顺序依次读取之后的9行 EXPLAIN SELECT * FROM `t_feed_info` AS i ORDER BY feed_id DESC LIMIT 0, 10; 点击(此处)折叠或打开 id select_type table type possible_keys key key_len ref rows Extra 1 SIMPL...
Handler_read_first原意:The number of times the first entry in an index was read. If this value is high, it suggests that the server is doing a lot of full index scans; for example, SELECT col1 FROM foo, assuming that col1 is indexed. 此选项表明SQL是在做一个全索引扫描,注意是全部,而...
2. limit 2观察Handler_read_first、Handler_read_rnd_next、Handler_read_key FLUSHSTATUS;select*fromtestlimit2;SHOWSESSIONSTATUSLIKEhandler_read%;explainselect*fromtestlimit2; 可以看到全表扫描其实也是走了key(Handler_read_key=1),可能是因为索引组织表的原因。因为limit 2 所以rnd_next为2.这个Stop Key在...
Handler_read_next The number of requests to read the next row in key order. This value is incremented if you are querying an index column with a range constraint or if you are doing an index scan. 此选项表明在进行索引扫描时,按照索引从数据文件里取数据的次数。
可以看到全表扫描其实也是走了key(Handler_read_key=1),可能是因为索引组织表的原因。因为limit 2 所以rnd_next为2.这个Stop Key在执行计划中是看不出来的。 3. 索引消除排序(升序),只走索引 复制 FLUSH STATUS;select data from test order by data limit 4;SHOW SESSION STATUS LIKE 'handler_read%';expla...
可以看到全表扫描其实也是走了key(Handler_read_key=1),可能是因为索引组织表的原因。因为limit 2 所以rnd_next为2.这个Stop Key在执行计划中是看不出来的。 3. 索引消除排序(升序),只走索引 复制 FLUSH STATUS;select data from test order by data limit 4;SHOW SESSION STATUS LIKE 'handler_read%';expla...
一、Handler_read_*值的实质 内部表示如下: {"Handler_read_first", (char*) offsetof(STATUS_VAR, ha_read_first_count), SHOW_LONGLONG_STATUS, SHOW_SCOPE_ALL}, {"Handler_read_key", (char*) offsetof(STATUS_VAR, ha_read_key_count), SHOW_LONGLONG_STATUS, SHOW_SCOPE_ALL}, ...
一、Handler_read_*值的实质内部表示如下:{"Handler_read_first", (char*) offsetof(STATUS_VAR, ha_read_first_count), SHOW_LONGLONG_STATUS, SHOW_SCOPE_ALL}, {"Handler_read_key", (char*) offsetof(STATUS_VAR, ha_read_key_count), SHOW_LONGLONG_STATUS, SHOW_SCOPE_ALL}, {"Handler_read_...
mysql> SHOW SESSION STATUS LIKE "%handler_read%"; +---+---+ | Variable_name | Value | +---+---+ | Handler_read_first | 1 | | Handler_read_key | 1 | | Handler_read_last | 0 | | Handler_read_next | 9 | | Handler_read...