所以这是一个非常简单的表'tbl':
+---------+---------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+---------------------+------+-----+---------+----------------+
| val | varchar(45) | YES | MUL | NULL | |
| id | bigint(20) unsigned | NO | PRI | NULL | auto_increment |
+---------+---------------------+------+-----+---------+----------------+
及其索引:
+--------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+--------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| tbl | 0 | PRIMARY | 1 | id | A | 201826018 | NULL | NULL | | BTREE | |
| tbl | 1 | val | 1 | val | A | 881336 | NULL | NULL | YES | BTREE | |
+--------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
我正在尝试这个简单的选择:
select val from tbl where val = 'iii';
结果:集合中有 86208 行(0.08 秒)
但是当我想稍微修改它时:
select id, val from tbl where val = 'iii';
结果是:集合中有 86208 行(47.30 秒)
我在指向的地方有一个索引,我正在修改的是结果行表示。为什么会有如此可怕的延迟?(我不得不说,我不能每次都重现这种延迟:即使在“重置查询缓存”或设置“查询缓存类型=关闭”命令之后也可以快速完成)。