Adhoc queries and deadlocks.

  • Will converting adhoc queris to stored procedures reduce deadlocks?

  • Just converting them to stored procs, probably not.

    To fix deadlocks, you need to identify the cause of that deadlock and fix that. It's probably bad code, bad indexes or both

    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
  • I would agree, straight conversion from Query to Stored Proc would not stop dead lock.

    Rather get the queries working right then convert them to a stored procedure.

  • yes this will not stop deadlocks on its own there are a number of things you must do, look at the table and how they are set-up the code you can commit trans before starting a new one this will also help. there are many ways to reduce dead locks one of the ways is to use row level locking, however, as they will always be a part of life the best way is to identify the underling in application causes and make the appropriate changes to that.

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

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