Researching Deadlocks

  • Hi all:

    I've seen that you can use trace flags 1204 and 1222 to return information to the error log about deadlocks:

    http://msdn.microsoft.com/en-us/library/ms178104%28v=sql.90%29.aspx

    I've also seen a comment on these forums that setting any trace flags could potentially introduce performance issues, but then I saw another comment where someone uses 1204 on their (busy) instance 24/7 without issue.

    How can I determine if setting these trace flags will significantly affect performance before I turn them on?

    Thanks...



    Del Lee

  • First, I'd stick to using 1222. It has better information than 1204. Second, yes, these are very lightweight processes. They don't put excessive load on the system. They capture the deadlock graph output from the deadlock into the error log. If they're going to put any kind of load on the system, it's during the writes to the error log. But I've run them for years on systems without ever hitting issues, so I have no trouble recommending their use.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Thanks for the recommendation. We have it turned on with no issues today. 🙂



    Del Lee

  • You can also use SQL Profiler to setup a trace via the GUI, or as a server side trace to capture the deadlock information. With this method, you don't need to set trace flags. Although, if the deadlocks don't occur very often, you may be better off with the trace flags.

    This is just another option.

    -

    Jason

    @emtJason

  • Yes, I was aware of the profiler trace option, but I had already ruled out doing that on a production server.



    Del Lee

  • Why rule it out because it's a production server? I would rule out running the Profiler GUI on the production server, but I wouldn't rule out running a server side trace.

    -

    Jason

    @emtJason

  • jason.spangler (8/31/2012)


    Why rule it out because it's a production server? I would rule out running the Profiler GUI on the production server, but I wouldn't rule out running a server side trace.

    -

    Jason

    @emtJason

    Ditto. It's a great way to capture information. If you were on 2008 or better you could use extended events, but a server-side trace is almost as good.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

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

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