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
996
April 05, 2016 10:42PM
480
April 06, 2016 10:15AM
459
April 06, 2016 11:23AM
534
April 06, 2016 08:11PM
428
April 06, 2016 10:35PM
436
April 07, 2016 12:34AM
457
April 07, 2016 10:20AM
440
April 07, 2016 11:26PM
434
April 12, 2016 07:42PM
441
April 06, 2016 08:57AM
436
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.