Tune Query

  • insert Emp

    select E.*

    from JobType as E , X..EmpIND as ID

    where E.EMpid = ID.Empid collate Latin1_General_CI_AI

    and E.EmpDate between ID.startDate and ID.endDate

    This query takes very longer to run, how cud i improve.

    thanks

  • What indexes do you have on the 3 tables?

    --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)

  • we have db's with same schema in the same instance, and this query is ran in all the db's and they run very gud except this db. what might be the reason.

  • 1. Have you verified that the schemas and indexes are identical between databases.

    2. Is there any difference the number of rows being insert between the databases.

    3. Read the article listed below for info on how best to ask for help. Help us help you!

  • Mike Levan (11/3/2008)


    we have db's with same schema in the same instance, and this query is ran in all the db's and they run very gud except this db. what might be the reason.

    Do they have the same amount of data?

    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
  • Are the statistics updated?

    "Keep Trying"

  • Mike Levan (11/3/2008)


    we have db's with same schema in the same instance, and this query is ran in all the db's and they run very gud except this db. what might be the reason.

    That's why I want you to verify that the indexes... and that they've seen some type of maintenance in the last day.

    --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)

Viewing 7 posts - 1 through 6 (of 6 total)

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