To much use of parenthesis (optimizer)

  • Hi,

    If we use to much parenthesis in our query (see beleow), does the optimiser are going to ignore thoses parenthesis and generate a good plan ? Or does the performance of the query are going to be affected ?

     

    FROM   ((((…………..

               LEFT OUTER JOIN……           ON

               (…………..     = ……………))

     

               LEFT OUTER JOIN …….       ON

               (……………   = …………….) AND

               (…………….  = …………….))

     

               LEFT OUTER JOIN ……… ON

               (…………….  = ……………))

     

               LEFT OUTER JOIN ………. ON

               (…………..   = ……………..)  AND

               (……………  = …………….) AND

               (……………  = …………….) AND

               (……………..= …………….'))

     

    thank you

    Danny (calico)

  • Why are there parenthesis around the join columns?  I shouldn't make a difference in the execution plan.  Try stripping out the unneeded parenthesis and comparing the exectution plans and runtime statistics.

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • i've seen programs which generate code based on user selections build queries like this....i would guess just running it thru query analyzer and having the show plan on would let youy see whether it affects the query:

    paste the query into a query window, do CONTROL+K to turn on show executtion plan and run it;

    compare it to the way you would write it normally and do the same thing...look for differences betweent eh two plans.

     

     

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

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

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