Home Forums SQL Server 7,2000 General Update Query and Joins in EM vs. Query Analyser RE: Update Query and Joins in EM vs. Query Analyser

  • Here's one argument against it, for devil's advocate sake. Sometimes, when doing performance tuning there are multiple ways to refine a particular query that can lead to different execution plans. In Query By Example, how would these VERY different statements be represented? :

    
    
    -- LEFT JOIN syntax will do a
    -- MERGE JOIN if indexed properly
    SELECT Column1 FROM Table1
    LEFT JOIN Table 2 ON Table1.PK = Table2.FK
    WHERE Table2.FK IS NULL
    -- SUBSELECT syntax will do
    -- a NESTED LOOP JOIN if indexed properly
    SELECT Column1 FROM Table1
    WHERE Table1.PK IN (SELECT Table2.FK FROM Table2)
    -- EXISTS syntax will also do
    -- a NESTED LOOP JOIN or better JOIN if
    -- inedexed properly
    SELECT Column1 FROM Table1
    WHERE EXISTS (SELECT * FROM Table2 WHERE Table2.FK = Table1.PK)

    The point is, Query By Example won't help identify performance gains from slight syntax variations that Query Analyzer coding will.