MySQL Forums
Forum List  »  InnoDB

How does size affect this query?
Posted by: Dan Bress
Date: February 22, 2008 12:59PM

I have a table with about 120 million records in it
each record has a state column, and a date column

I am executing the query

select distinct(thingid) from table where state=1 order by datecolumn asc limit 150;

i have an index of state,datecolumn

if the number of items in a state of 1 is small(less than 10,000) this query very very quickly. However, right now there are several million records in a state of 1, and this is causing the query to slow down to take a second or two per call.


It seems like having more records in a state of 1 slows things down.
Is this expected? Is there anything we can do to improve this?

Options: ReplyQuote


Subject
Views
Written By
Posted
How does size affect this query?
2651
February 22, 2008 12:59PM
1381
February 22, 2008 02:57PM


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.