Seth Price wrote:

Wouldn't you get the same result from your query by using an INNER JOIN and dropping the temp.xy IS NOT NULL clause?

I am not sure, that is why I am asking y'all. My only problem with that is does INNER JOIN create a 200k table with 180 columns and do the selection from that? Or does it SELECT from one table, JOIN the results to the other table, then SELECT again? (which is what I want)

The specifics of your script would help. But, in general, I'm against trying to out-guess SQL optimizers. It's usually counterproductive to do so, since you can end up spending a lot of time and effort micromanaging something that the optimizer may do adequately now and brilliantly in another release. Instead, tell it what you want, and see if it's fast and efficient enough. If it isn't, *then* worry about it.

That said, you seem to have a case where a temporary table might be
effective as a starting point for multiple other queries.  In that case,
it could make sense to introduce that temporary table from the start,
because you can be reasonably (not completely) confident that it'll
always give you a benefit, and it will also make maintenance simpler in
the future since you've in effect modularized a bit.

One other consideration, though, is how much overlap there is between
the successive queries.  If you can actually fold it up into a single,
more complex, query, that will probably be the most effective solution
overall.

YMMV.  I'm a newbie to MySQL, so my generalities may not hold up for
this specific DBMS.

Bruce Feist




--------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



Reply via email to