InnoDBの場合。MyISAMは全くアテにならなかった(少なくとも5.7.11では)
InnoDBでも所詮統計情報なので完全にアテになる訳じゃないのはお約束。
テスト。
mysql57> CREATE TABLE t1 (val char(250));[さらに読む]
Query OK, 0 rows affected (0.02 sec)
mysql57> INSERT INTO t1 SET val= '';
Query OK, 1 row affected (0.00 sec)
mysql57> INSERT INTO t1 SELECT * FROM t1;
Query OK, 1 row affected (0.00 sec)
Records: 1 Duplicates: 0 Warnings: 0
..
mysql57> INSERT INTO t1 SELECT * FROM t1;
Query OK, 131072 rows affected (1.67 sec)
Records: 131072 Duplicates: 0 Warnings: 0
ysql57> ANALYZE TABLE t1;
+-------+---------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+-------+---------+----------+----------+
| d1.t1 | analyze | status | OK | …