
On Sun, 6 May 2012 05:49:37 pm Russell Coker wrote:
Thanks for the suggestions. The union works, but I'd prefer to have a join if possible as the SQL statement I provided to the list was a simplified version of the real thing. The real statement is long enough that putting it in twice would be bad for code maintenance.
The JOIN that you suggested unfortunately has the performance problem.
These sorts of performance issues are a bit of a black art. You need to match the structure of the indexes with the query to coax the query planner to do what you expect. If this were Postgres there would be an EXPLAIN statement to explain what the query planner is thinking. Look for similar tools with MySQL. -- Anthony Shipman Mamas don't let your babies als@iinet.net.au grow up to be outsourced.