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
1051
April 05, 2016 10:42PM
504
April 06, 2016 10:15AM
487
April 06, 2016 11:23AM
562
April 06, 2016 08:11PM
454
April 06, 2016 10:35PM
466
April 07, 2016 12:34AM
488
April 07, 2016 10:20AM
468
April 07, 2016 11:26PM
469
April 12, 2016 07:42PM
469
April 06, 2016 08:57AM
465
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.