List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:May 3 2006 9:29pm
Subject:Re: Q2. Is there anything could be done to speed up this query
View as plain text  
In the last episode (May 03), Mikhail Berman said:
> Thank you, Chris 
> 
> But the table is indexed on the field you are referring to and the other
> one the query, which is evident from this:
> 
> >   KEY `prdadadx` (`price_data_date`),
> >   KEY `prdatidx` (`price_data_ticker`)

These are two separate keys, though, and your query is doing a GROUP BY
across both fields, so neither of those keys would be useful (mysql
would have to do a random record lookup for each row to fetch the other
field).  Try an index on (price_data_ticker, price_data_date).  Since
your query only references those fields, mysql should be able to return
your results just by scanning the index.

-- 
	Dan Nelson
	dnelson@stripped
Thread
Q2. Is there anything could be done to speed up this queryMikhail Berman3 May
  • Re: Q2. Is there anything could be done to speed up this queryChris White3 May
RE: Q2. Is there anything could be done to speed up this queryMikhail Berman3 May
  • Re: Q2. Is there anything could be done to speed up this queryDan Nelson3 May
RE: Q2. Is there anything could be done to speed up this queryMikhail Berman4 May