Avoid LEFT join

  • Chris any update?

  • mohanaprabhu.v (6/4/2015)


    Chris any update?

    ChrisM@Work (6/4/2015)


    ...

    Sure. Start a new thread, and include the Actual Execution Plan as an attachment.

    If you want all columns from your invoice table, your options for tuning this query will be limited.

    β€œWrite the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

  • New questions in a new thread please.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • HelloHai (6/4/2015)


    Yes i want all columns from invoice table,

    You query has no limiting criteria on either the invoice or customer table which means that the best you can do is return the entire invoice table and maybe get an index scan out of the customer table. There's basically no way to improve the query for performance if you already have an index on the CustomerNo with "includes" on the first and last names all from the customer table. If you don't already have such an index, adding one will likely provide only a relatively small improvement.

    Opening a new thread probably won't change those facts. πŸ˜‰

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden (6/4/2015)


    Opening a new thread probably won't change those facts. πŸ˜‰

    He posted a new thread, posted a query slightly different to the one here (with a few WHERE clause predicates), then edited all his posts to remove all info.:unsure:

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 5 posts - 16 through 19 (of 19 total)

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