MySQL Forums
Forum List  »  Performance

Re: Why is ORDER BY ASC is slow but ORDER DESC is fast ? and how can i fix it ?
Posted by: Ronald Brown
Date: October 05, 2015 10:50AM

Rick James Wrote:
-------------------------------------------------------
> Or you could "DROP INDEX comments_count" unless it
> is otherwise needed.


i have dropped index for now and resetting the slow query log, will watch for next 24 hours.,

the query is quite fast now

25 rows in set (0.03 sec)

mysql> explain SELECT * FROM content WHERE enabled = 1 AND category IN (600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620) AND upload_date >= '2015-08-31' ORDER BY comments_count ASC LIMIT 900,25\G
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: content
type: range
possible_keys: upload_date,e_c_d_v,e_d_v,e_c_v,e_v,e_u,e_s_d
key: e_c_d_v
key_len: 8
ref: NULL
rows: 34390
Extra: Using index condition; Using filesort
1 row in set (0.00 sec)

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Why is ORDER BY ASC is slow but ORDER DESC is fast ? and how can i fix it ?
916
October 05, 2015 10:50AM


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.