Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select some_other_column
- from `table`
- order by primary_index_column asc
- limit 4000000, 10;
- select some_other_column
- from `table`
- order by secondary_index_column asc
- limit 4000000, 10;
- mysql> explain select some_other_column from `table` order by primary_index_column limit 4000000, 10;
- +----+-------------+---------+-------+---------------+---------+---------+------+---------+-------+
- | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
- +----+-------------+---------+-------+---------------+---------+---------+------+---------+-------+
- | 1 | SIMPLE | table | index | NULL | PRIMARY | 4 | NULL | 4000010 | |
- +----+-------------+---------+-------+---------------+---------+---------+------+---------+-------+
- mysql> explain select some_other_column from `table` order by secondary_index_column limit 4000000, 10;
- +----+-------------+---------+------+---------------+------+---------+------+---------+----------------+
- | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
- +----+-------------+---------+------+---------------+------+---------+------+---------+----------------+
- | 1 | SIMPLE | table | ALL | NULL | NULL | NULL | NULL | 4642945 | Using filesort |
- +----+-------------+---------+------+---------------+------+---------+------+---------+----------------+
- ALTER TABLE `table` ADD INDEX mynewndx (indexed_column,some_other_column);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement