Re: join speed vs. 2 queries

2005-02-15 Thread Peter Brawley
Matthew, >...is there a benefit to doing the INNER JOIN in the FROM clause >rather than creating a join condition in the WHERE clause? I rewrote >the query a bit using the WHERE join condition and noticed a slight >performance hit on this particular query... There are (at least) three benefits to p

Re: join speed vs. 2 queries

2005-02-15 Thread Mathew Ray
Many Thanks Peter, I appreciate your response. Played around with the indexes, and modified the query a bit more to match the campaignId of the value first and got a 2000x performance increase from the original query...now it takes .03 seconds on average where it used to take 60. One question t

Re: join speed vs. 2 queries

2005-02-14 Thread Peter Brawley
>I have a gut feeling that this kind of join should be able to be >done with similar speed without having to use a temp table Yep but remember the query engine uses one index per table so without seeing your EXPLAIN output I'd try indexing ... the data table on name_id,value_id,campaign_id, t

join speed vs. 2 queries

2005-02-14 Thread Mathew Ray
Newbie on the list here having a bit of confusion at the moment why an INNER JOIN is taking so long... I have replaced a few column names to make it a bit more succinct: SELECT COUNT(*) FROM data, values, names WHERE data.campaign_id = 22 AND names.name = 'content' AND values.value = 'index' AND