MySQL Forums :: Performance :: order by primary key slowly


Advanced Search

Re: order by primary key slowly
Posted by: varky chan ()
Date: April 06, 2016 08:11PM

mysql> explain select id from user limit 1000000,10;
+----+-------------+-------+-------+---------------+-----------------+---------+------+---------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+-------+---------------+-----------------+---------+------+---------+-------------+
| 1 | SIMPLE | user | index | NULL | invite_user_idx | 5 | NULL | 5465723 | Using index |
+----+-------------+-------+-------+---------------+-----------------+---------+------+---------+-------------+
1 row in set (0.51 sec)

mysql> explain select id from user order by id limit 1000000,10;
+----+-------------+-------+-------+---------------+---------+---------+------+---------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+-------+---------------+---------+---------+------+---------+-------------+
| 1 | SIMPLE | user | index | NULL | PRIMARY | 4 | NULL | 1000010 | Using index |
+----+-------------+-------+-------+---------------+---------+---------+------+---------+-------------+
1 row in set (0.00 sec)

Actually, the table have another filed named invite_user_id with int type, and a index named invite_user_idx for it.

Options: ReplyQuote


Subject Views Written By Posted
order by primary key slowly 894 varky chan 04/05/2016 10:42PM
Re: order by primary key slowly 399 Øystein Grøvlen 04/06/2016 04:35AM
Re: order by primary key slowly 439 varky chan 04/06/2016 10:15AM
Re: order by primary key slowly 412 Peter Brawley 04/06/2016 11:23AM
Re: order by primary key slowly 484 varky chan 04/06/2016 08:11PM
Re: order by primary key slowly 378 Peter Brawley 04/06/2016 10:35PM
Re: order by primary key slowly 389 varky chan 04/07/2016 12:34AM
Re: order by primary key slowly 423 Øystein Grøvlen 04/07/2016 07:21AM
Re: order by primary key slowly 408 Peter Brawley 04/07/2016 10:20AM
Re: order by primary key slowly 388 varky chan 04/07/2016 11:26PM
Re: order by primary key slowly 371 Rick James 04/12/2016 07:42PM
Re: order by primary key slowly 390 Peter Brawley 04/06/2016 08:57AM
Re: order by primary key slowly 382 varky chan 04/06/2016 10:17AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.