MySQL Forums
Forum List  »  Performance

Select last date check all rows
Posted by: Pär Nordlund
Date: August 04, 2015 08:47AM

Hey,

I have some slow query issues where i do something like :

SELECT x FROM y WHERE datefield < NOW() order by datefield DESC LIMIT 1

The result from EXPLAIN XXX shows that the row count is 100k+

Shouldnt it be able to just fetch the latest row if datefield is an index?

The table holds like 150k rows, and it takes about 5-6 sec to execute such as query.

Options: ReplyQuote


Subject
Views
Written By
Posted
Select last date check all rows
1589
August 04, 2015 08:47AM
750
August 05, 2015 05:49PM
696
August 06, 2015 10:36PM
750
August 08, 2015 11:11AM


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.