-- tested with MySQL 5.6 -- full table scan EXPLAIN SELECT * FROM history WHERE id + 300 = 400; -- uses index EXPLAIN SELECT * FROM history WHERE id = 400 - 300;
id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
---|---|---|---|---|---|---|---|---|---|---|---|
1 | SIMPLE | history | null | ALL | null | null | null | null | 1407 | 100 | Using where |
id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
---|---|---|---|---|---|---|---|---|---|---|---|
1 | SIMPLE | history | null | const | PRIMARY | PRIMARY | 4 | const | 1 | 100 | null |