Query Efficiency with left outer join and temp table

  • Hi, We are writing a query to extract the data from oledb source(sql server) in the Data flow task. Would like to know which query/approach is more efficient.

    Query 1:

    Select list from A

    left outer join B

    on A.a= B.b

    left outer join C

    on A.c=C.c

    lefter outer join D

    on A.d=D.d

    Query 2:

    Join table A and table B

    and then insert in to temp table

    and then join the temp table with table C

    and insert into another temp table

    and then join this temp table with table D

    Thank you

  • Execution Plans for both? Time to execution and statistics? Data volume of the core tables and sub tables, vs. resultant volume in the temps? Indexes?

    The query itself is the beginning of the discussion. After that you have to examine how it reacts in your particular system, what else is going on, who blocks who, what your schema is... See the two links on the left in my signature, particularly the bottom left one, for the kind of information we'd need to help you answer your question.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • Hi Kraig,

    thanks for the reply.

    I have attached both the queries, table scripts and execution plans for both queries.

    The data retrieved by the query is 182296.

    I am not good at evaluating the execution plans, plz help me understanding the execution plans. What i observed is query without temp table took 11 seconds to fetch the data and the query with the temp table took 14 seconds to fetch the same data.

    Thank you

  • Novice, sorry, this completely fell off my radar and I saw it cleaning out some old stuff. Are you still having issues with this? If so, I can try to pick it up again and help you out.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • Craig, sorry for late reply, I was out on vacation, Yeah my query has been resolved. thank you

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

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