--- Stuart Jansen <[EMAIL PROTECTED]> wrote: > On Mon, 2004-01-05 at 20:14, Daniel Crookston wrote: >> Ewww, sub-selects. Not a very efficient use of the DB, >> is it? I was under the impression that it's just as >> fast (with MySQL at least) to just do the sub-select >> yourself in the code instead of relying on the database >> to do it.
> Think about if for a moment. Such a comment is obviously > wrong. Which is better, copying 100,000 rows (possible > across a network connection) and then building the next > set of queries by hand, or letting all the data stay in > the DB itself where it can be optimized by people who's > specialty is doing such? Especially if many of those rows > ending being irrelevant to the result? Sub-select exist > for a reason, Monty's prejudices aside. Sure, sub-selects > shouldn't be used in every query, but a good programmers > is paid to know when they are appropriate. Sub-queries have their place, but very often they can be replaced by some form of join. Indeed, that's exactly what the query optimizer usually does with them. In any event, MySQL does support sub-queries, at least, as of version 4.1. While 4.1 is still officially an alpha release, I haven't run into significant problems using it to run web sites -- although the main reason for using it in that way is the Unicode support, not the sub-queries. ===== PGP Key ID: 071B173D Fingerprint: ED30 B048 6833 56B4 28C0 CE52 F12B 884A 071B 173D __________________________________ Do you Yahoo!? Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes http://hotjobs.sweepstakes.yahoo.com/signingbonus ____________________ BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________ List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list
