(see attached code to prepare)
|
|
analyze select * from noCondition;
|
+------+-------------+-------+-------+---------------+---------+---------+-------+------+--------+----------+------------+-------------+
|
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | r_rows | filtered | r_filtered | Extra |
|
+------+-------------+-------+-------+---------------+---------+---------+-------+------+--------+----------+------------+-------------+
|
| 1 | SIMPLE | a | const | PRIMARY | PRIMARY | 4 | const | 1 | NULL | 100.00 | NULL | Using index |
|
| 1 | SIMPLE | b | ALL | NULL | NULL | NULL | NULL | 1 | 1.00 | 100.00 | 100.00 | Using where |
|
+------+-------------+-------+-------+---------------+---------+---------+-------+------+--------+----------+------------+-------------+
|
|
analyze select * from forceConditionU;
|
+------+-------------+-------+-------+---------------+---------+---------+-------+------+--------+----------+------------+-------------+
|
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | r_rows | filtered | r_filtered | Extra |
|
+------+-------------+-------+-------+---------------+---------+---------+-------+------+--------+----------+------------+-------------+
|
| 1 | SIMPLE | a | const | PRIMARY | PRIMARY | 4 | const | 1 | NULL | 100.00 | NULL | Using index |
|
| 1 | SIMPLE | b | ALL | NULL | NULL | NULL | NULL | 1 | 1.00 | 100.00 | 100.00 | Using where |
|
+------+-------------+-------+-------+---------------+---------+---------+-------+------+--------+----------+------------+-------------+
|
|
analyze select * from forceConditionM;
|
+------+-------------+-------+-------+---------------+---------+---------+-------+------+--------+----------+------------+-------------+
|
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | r_rows | filtered | r_filtered | Extra |
|
+------+-------------+-------+-------+---------------+---------+---------+-------+------+--------+----------+------------+-------------+
|
| 1 | SIMPLE | a | const | PRIMARY | PRIMARY | 4 | const | 1 | NULL | 100.00 | NULL | Using index |
|
| 1 | SIMPLE | b | ALL | NULL | NULL | NULL | NULL | 1 | 1.00 | 100.00 | 100.00 | Using where |
|
+------+-------------+-------+-------+---------------+---------+---------+-------+------+--------+----------+------------+-------------+
|
|
analyze select straight_join `a`.`id` AS `id` from (`b` join `a` on(`b`.`notIndexed` = `a`.`id`)) where `a`.`id` = 1;
|
+------+-------------+-------+-------+---------------+---------+---------+-------+------+--------+----------+------------+-------------+
|
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | r_rows | filtered | r_filtered | Extra |
|
+------+-------------+-------+-------+---------------+---------+---------+-------+------+--------+----------+------------+-------------+
|
| 1 | SIMPLE | b | ALL | NULL | NULL | NULL | NULL | 1 | 1.00 | 100.00 | 100.00 | Using where |
|
| 1 | SIMPLE | a | const | PRIMARY | PRIMARY | 4 | const | 1 | 1.00 | 100.00 | 100.00 | Using index |
|
+------+-------------+-------+-------+---------------+---------+---------+-------+------+--------+----------+------------+-------------+
|