Investigating index locking with SQL Server Profiler

NaviDeveloper_NL
Member Posts: 42
I am trying to find out what indexes are locked and how long they are locked when executing a query. I want to use Profiler for this. I choose the events Lock:Acquired and Lock:Released.
When I see the results in Profiler, I do not find the objectid of the index being locked. Is it possible to do this like for example with sp_lock? (column ObjId).
Sp_lock does not give me the desired information because this only gives the current locks when it runs, not during a transaction.
Also sp_lock gives me the type of lock like key, page or table.
When I see the results in Profiler, I do not find the objectid of the index being locked. Is it possible to do this like for example with sp_lock? (column ObjId).
Sp_lock does not give me the desired information because this only gives the current locks when it runs, not during a transaction.
Also sp_lock gives me the type of lock like key, page or table.
0
Comments
-
What is the purpose of this? SQL Server is locking permanently various kinds of system resources, even though most of these locks just take few microseconds ...
IMO it is important to keep track about the blocks that result from the locks; means when another process is affected by a lock.
If you're looking for an "Automatic Block Detection" I could give you some hints ...Jörg A. Stryk (MVP - Dynamics NAV)
NAV/SQL Performance Optimization & Troubleshooting
STRYK System Improvement
The Blog - The Book - The Tool0 -
The purpose of this is that I want to see the effect of code changes on locking behaviour.
Less locking would mean less blocking.
Keeping track of the blocks that result from the locks normally has to be done if the code is LIVE already.0 -
Blocks are the result of transactions that take to long.
Transactions take to long because, a) It takes to long to update indexes and sift levels, b) the transaction has slow reading speed, c) the hardware is configured wrongly.
Try to speed up the processes first.0 -
Mark Brummel wrote:Blocks are the result of transactions that take to long.
Transactions take to long because, a) It takes to long to update indexes and sift levels, b) the transaction has slow reading speed, c) the hardware is configured wrongly.
Try to speed up the processes first.
e.g. Change/delete/insert some record(s) at the beginning of a function, then a lot of reading/processing or a CONFIRM-message( :evil: ) and in the end something is written and then a COMMIT is done.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions