List:General Discussion« Previous MessageNext Message »
From:Mikhail Berman Date:May 4 2006 1:10pm
Subject:RE: Q2. Is there anything could be done to speed up this query
View as plain text  
 
Thank you Dan,

I will try that.

Mikhail Berman

-----Original Message-----
From: Dan Nelson [mailto:dnelson@stripped] 
Sent: Wednesday, May 03, 2006 5:29 PM
To: Mikhail Berman
Cc: Chris White; mysql@stripped
Subject: Re: Q2. Is there anything could be done to speed up this query

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

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/mysql?unsub=1

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