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


Advanced Search

order by primary key slowly
Posted by: varky chan ()
Date: April 05, 2016 10:42PM

There is a user table on my database with InnoDB storage engine like following:

CREATE TABLE user (
id int not null auto_increment,
name varchar(50) not null,
password char(64) not null,
email varchar(80) not null,
primary key (id),
unique key (username)
) Engine=InnoDB;

And about 7 millions user data in it. When i execute some queries as follows:

1. select id from user limit 1000000,10;
2. select id from user order by id desc limit 1000000,10;

The first query above is faster, the second query is very slow. What's happen about the second query? Why it is slow?

Options: ReplyQuote


Subject Views Written By Posted
order by primary key slowly 892 varky chan 04/05/2016 10:42PM
Re: order by primary key slowly 398 Øystein Grøvlen 04/06/2016 04:35AM
Re: order by primary key slowly 438 varky chan 04/06/2016 10:15AM
Re: order by primary key slowly 411 Peter Brawley 04/06/2016 11:23AM
Re: order by primary key slowly 483 varky chan 04/06/2016 08:11PM
Re: order by primary key slowly 377 Peter Brawley 04/06/2016 10:35PM
Re: order by primary key slowly 388 varky chan 04/07/2016 12:34AM
Re: order by primary key slowly 422 Øystein Grøvlen 04/07/2016 07:21AM
Re: order by primary key slowly 407 Peter Brawley 04/07/2016 10:20AM
Re: order by primary key slowly 387 varky chan 04/07/2016 11:26PM
Re: order by primary key slowly 370 Rick James 04/12/2016 07:42PM
Re: order by primary key slowly 389 Peter Brawley 04/06/2016 08:57AM
Re: order by primary key slowly 381 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.