Re: [nyphp-talk] Adding indexes

2010-03-22 Thread Daniel Convissor
Hi Nick: > $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 w

Re: [nyphp-talk] Adding indexes

2010-03-22 Thread Rob Marscher
On Mar 22, 2010, at 1:31 PM, John Campbell wrote: ...snip... > 1: add an index on the timestamp 'leave' ...snip... > This is because mysql never uses indexes when a function is on the > left hand side. > There is no "formula" to follow, but you need to intuitively > understand how relational datab

Re: [nyphp-talk] Adding indexes

2010-03-22 Thread John Campbell
On Mon, Mar 22, 2010 at 11:00 AM, Nicholas Hart wrote: > 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."' >       

Re: [nyphp-talk] Mar 23 Meeting

2010-03-22 Thread Hans Zaunere
Hello, > I'm very interested in the topic for tomorrow's meeting (Coding for > Mobile Web Applications) -- but can't attend due to work. Will the > presentation be posted anywhere? Yes, likely the presentation slides will be posted in the archives: http://www.nyphp.org/PHP-Presentations

Re: [nyphp-talk] Adding indexes

2010-03-22 Thread Adrian Noland
In addition to what others said... There is a lot more instruction both online and offline, but here is a brief example illustrating EXPLAIN: http://www.experts-exchange.com/articles/Database/MySQL/3-Ways-to-Speed-Up-MySQL.html The docs can be a bit dense if you're not familiar with what you are

Re: [nyphp-talk] Adding indexes

2010-03-22 Thread Rob Marscher
On Mar 22, 2010, at 11:00 AM, Nicholas Hart 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 a

[nyphp-talk] Mar 23 Meeting

2010-03-22 Thread SyAD
Hi all, I'm very interested in the topic for tomorrow's meeting (Coding for Mobile Web Applications) -- but can't attend due to work. Will the presentation be posted anywhere? Thanks, Steve ___ New York PHP Users Group Community Talk Mailing List h

Re: [nyphp-talk] Adding indexes

2010-03-22 Thread Anthony W
It depends on where the join is occurring. If you have a HABTM relationship between the join tables then a index should be added to the pivot table. If not then I would assume that the column you are joining on would be a candidate for an index. Do these tables have a PRIMARY KEY already est

[nyphp-talk] Adding indexes

2010-03-22 Thread Nicholas Hart
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