NYCPHP Meetup

[nycphp-talk] Adding indexes

Adrian Noland 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
http://hackmysql.com/case2

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.
>
> Nick
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20100323/7a903600/attachment.html>


More information about the talk mailing list