|
1) If the join to rank_lookup is done across Pkey and/or unique
indexed fields and a foreign key is defined for said join, I don't know
how the subquery could possibly be more optimized then it is (the
reasoning being beyond the scope of this discussion and possibly even
beyond the scope of area in which I can safely comment :) 2) It is my understanding and experience (I could be unaware of a trick or special case specifics, however) that using an IN clause is LESS efficient then joining to the table. The only reason I used the in clause is because, as you indicated, you were only ask for the top five, which is a very small set (you probably would not want to do that if the set was large). Indeed, the IN clause is a de-optimization, it only HAPPENS to make the query run faster because it allows you to avoid calling the select function for all but the selected 5 rows (which was the goal you requested) 3) In SQL there is almost always more then 1 way of doing something, you have now seen 2. There may be more, possibly even better ways. Experts care to comment? :) Terry Fielder [EMAIL PROTECTED] Associate Director Software Development and Deployment Great Gulf Homes / Ashton Woods Homes Fax: (416) 441-9085 Markus Schiltknecht wrote: Hello Terry, |
- Re: [GENERAL] Unnecessary function calls Markus Schiltknecht
- Re: [GENERAL] Unnecessary function calls Terry Fielder
