From: Dan Nelson Date: May 3 2006 9:29pm Subject: Re: Q2. Is there anything could be done to speed up this query List-Archive: http://lists.mysql.com/mysql/197584 Message-Id: <20060503212901.GD65700@dan.emsphone.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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