命令: SELECT count(*) FROM table WHERE `a`=21 OR `b`=4301;
+----+-------------+--------------------+------------+-------------+---------------------+----------------+---------+------+--------+----------+-----------------------------------------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+--------------------+------------+-------------+---------------------+----------------+---------+------+--------+----------+-----------------------------------------------+
| 1 | SIMPLE | table | NULL | index_merge | index_a,index_b,index_ab | index_ab,index_b | 5,5 | NULL | 639711 | 100.00 | Using sort_union(index_ab,index_b); Using where |
+----+-------------+--------------------+------------+-------------+---------------------+----------------+---------+------+--------+----------+-----------------------------------------------+
----------------分隔符------------------------
命令: SELECT count(*) FROM table WHERE `a`=21 OR `b`=4301;
+----------+
| count(*) |
+----------+
| 690113 |
+----------+
1 row in set (2 min 23.63 sec)
----------------分隔符------------------------
-------------------------
您是说 explain 的 rows 639711 就是总条数吗?
但是和 count 的 690113 数量不同
@
taogen