Re: Query Optimization ... Is this all I can get??
Posted in 2003
Anthony Presley wrote: > > Although your first option would work in my case, it would be a mess, > as they would have to be OUTER joins of the address and phone table, > and the joining of some 100K with 300K with another 150K takes some > time [although, this was my original solution]. Why would an outerjoin make it a mess? It will make it elegant, and should improve your performance to boot. I haven't looked at your tables and queries in any detail, but assuming the engine is able to use appropriate indexes to sequence the fetches efficiently, then using outer joins is far better than manually performing your own joins using separate cursors. An outer join can be as good as an ordinary join with the only difference being, if no matching row is found in the outered table, the engine simply supplies null in the columns. Where's the mess?