
mysql> ANALYZE TABLE t1;
+---------+---------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+---------+---------+----------+----------+
| test.t1 | analyze | status | OK |
+---------+---------+----------+----------+
1 row in set (0.08 sec)
mysql> select count(*) from t1 where f2>40;
+----------+
| count(*) |
+----------+
| 80 |
+----------+
1 row in set (0.00 sec)
mysql> EXPLAIN SELECT f1, f2 FROM t1 WHERE f2 > 40;
+----+-------------+-------+------------+-------+---------------+---------+---------+------+------+----------+----------------------------------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+-------+------------+-------+---------------+---------+---------+------+------+----------+----------------------------------------+
| 1 | SIMPLE | t1 | NULL | range | PRIMARY | PRIMARY | 8 | NULL | 53 | 100.00 | Using where; Using index for skip scan
统计信息已经是最新的了,明明是80,explain中的rows =53,怎么理解?
2:filtered =100,怎么理解?
3:mysql中的explain应该是假跑的,怎么获取真实的跑sql的执行计划呢??