Long running queries

  • hi

    How to handle long running queires?

    Koteswarrao

  • I assume you want to speed them up. Correct?

    Is there blocking?

    Is the query written optimally?

    Are the indexes useful (ie, is the query using indexes).

    Run the query with the execution plan on and Statistics IO switched on. Look for high cost operators, table scans, index scans and tables with large numbers of reads. Dpending on the cause, you may have to change the query or you may have to change the indexes.

    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
  • What exactly do you mean by "handle". If you want to prevent queries which are expected to run for longer than certain number of seconds, you can use the Query Governor in Server properties -> Connections. Please note that Query Governor works based on the estimated cost and not the actual cost of the query as determined by the query optimizer. So you will have to try around with this to see if it fits your requirement.

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

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