MySQL Forums
Forum List  »  Performance

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
2692
April 05, 2016 10:42PM
1158
April 06, 2016 10:15AM
1189
April 06, 2016 11:23AM
1291
April 06, 2016 08:11PM
1251
April 06, 2016 10:35PM
1188
April 07, 2016 12:34AM
1240
April 07, 2016 10:20AM
1136
April 07, 2016 11:26PM
1274
April 12, 2016 07:42PM
1125
April 06, 2016 08:57AM
1123
April 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.