René Fournier wrote:
Thanks! I will try this Monday. On a related note, does the 'temporary table' approach (creating, locking, dropping) significantly slow down queries? I haven't had to use them yet, and my application is somewhat performance sensitive, so... just curious.
It's actually a *lot* faster if you put some effort into it. When you use a sub-query, any indexes on the original fields inside the sub-query are not used in the join further up ( ie the derived table has no indexes on it ). So if you have a lot of data coming through in the sub-query, it's very much worth it to create a temporary table *with* *indexes* on fields you will be joining on. I was hoping MySQL would support automatically indexing result fields inside a sub-query like this, but apparently it's not on the cards :(

--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: [EMAIL PROTECTED]
website: http://www.nusconsulting.com.au

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to