Lock escalation on create procedure

  • Hi,

    When I run the SQL Profiler to detect lock escalation, I noticed it detected a lot of lock escalation with the textdata indicating "create procedure" on certain stored procedure.

    Any idea what this means?

    Thanks.

  • Just did some testing and the SQL Profiler actually logs those create stored procedure when you do an execute on the stored procedure and there are lock escalation (from page to table) in that stored procedure, which is a bit miss leading as it indicates create procedure.

  • This was removed by the editor as SPAM

  • Basically, there's a lock in place during execution to prevent updates during execution. That's all.

    "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

  • It just that the SQL Profiler show the textdata as a create procedure which is misleading, it should have been display the execute stored procedure command.

  • In that case, it's referencing the object, not the call, so the text is showing the object definition.

    "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

  • I had another look and it actually shows the entire create stored procedure, all the TSQL within it including the comments.

  • right, the object definition.

    "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

  • Yes, it shows the complete object definition.

    It has to be the object definition, not the EXEC, so that you can use the statement_start_offset and statement_end_offset to pinpoint the statements (DMVs like sys.dm_exec_requests)

    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
  • Thanks all, similar how do you tell what escalation setting has been configured on a table?

    I know you can change it to AUTO, DISABLE or TABLE but how do you query the current setting on the table?

  • It's in sys.tables.

    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 11 posts - 1 through 10 (of 10 total)

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