JOIN optimization

  • Hello!

    Is there some basic rules when JOINing multiple tables? Like is there a performance difference when I change the order of the JOINs? I get the same records with my queries regardless the join order. But is there a difference?

    Thank you!

    /Tomi

  • Back in versions 4.2, 6.0, and 6.5 it made a VERY MAJOR difference. It was part of a DBA's job in optimizing queries. With the "Optimizer" in todays versions, it doesn't make such a difference, though I've found that it still does have enough of an impact to make it worth working with on particuarly large or complex queries. In my opinion, they could have left off the "Optimizer" and I would have been quite happy. Follows the age old rule of "Ease of use means loss of functionality"

  • Thanks!

    There is a optimizer in the server? Does that mean that if I join five tables with totally different number of rows it doesn't matter in what order i join them? Did I understand you correctly?

    /Tomi

  • Sometimes it can, the optimizer is really good and gets better each new SQL version. But from 7 and 2000 I have found a few occasion where controlling the order of operation by suqeuries can help and if in nested relations by how they relate instead of all in a line these do change the output as well in many cases. Sorry no solid example I can give off hand.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply