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
940
April 05, 2016 10:42PM
460
April 06, 2016 10:15AM
438
April 06, 2016 11:23AM
506
April 06, 2016 08:11PM
402
April 06, 2016 10:35PM
411
April 07, 2016 12:34AM
430
April 07, 2016 10:20AM
414
April 07, 2016 11:26PM
406
April 12, 2016 07:42PM
410
April 06, 2016 08:57AM
406
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.