[nycphp-talk] Adding indexes
anoland at indigente.net
Tue Mar 23 17:29:24 EDT 2010
Just in case you need some more information about how to fix your queries,
this walks you through some examples
On Mon, Mar 22, 2010 at 10:00 AM, Nicholas Hart <nhart at partsauthority.com>wrote:
> I am looking to analyze and speed up some of my queries by adding any
> necessary indexes. Is there a formula to follow in adding indexes to
> multiple join queries? I have made some attempts using explain but am not
> sure I understand it all that well.
> For example:
> $sql = "select dt1.*, d.* from
> driver d join
> (select `driver`, date(`leave`), sum(`points`) as pnts,
> sum(`xpnts`) as xpnts from check_head
> where date(`leave`) = '".$sdate."'
> group by `driver`) dt1
> on dt1.driver = d.id_num where `store` = '".$userStore."' ";
> Any suggestions welcome. Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the talk