如何找出页面锁所属的表 [英] How to find out what table a page lock belongs to
问题描述
当我们遇到性能问题时,我正在使用sys.dm_tran_locks
视图检查数据库的哪些区域有锁.
I'm using the sys.dm_tran_locks
view to check what areas of my database have locks when we are having performance problems.
使用此视图....
-
如果resource_type是 database ,我可以使用DB_NAME函数来查找具有锁定功能的数据库.
If the resource_type is database I can use the DB_NAME function to find out what database has the lock.
如果它是一个对象,我通常可以加入sys.tables来检查它是什么表.
If its an object I can normally join to sys.tables to check what table it is.
但是,如果resource_type是 Page 或 Key ,有什么方法可以将其追溯到其父表,这样我就可以很好地了解哪些表已锁定?
However if the resource_type is Page or Key is there any way to trace this back to its parent table so I can get a good idea of which tables are locking?
推荐答案
这是resource_associated_entity_id
列的用途(
查看全文