I have a query on SQL Server 2008 that when using sp_whoisactive with get_locks = 1 has the following locks open….
<Object name="my_table" schema_name="dbo"> <Locks> <Lock resource_type="KEY" index_name="pk_mypk" request_mode="X" request_status="GRANT" request_count="1" /> <Lock resource_type="OBJECT" request_mode="IX" request_status="GRANT" request_count="1" /> <Lock resource_type="PAGE" page_type="*" index_name="pk_mypk" request_mode="IX" request_status="GRANT" request_count="1" /> </Locks> </Object>
I understand the Key and Page lock but am unsure what the Object one is. Is that a table lock? If so why did it bother taking key and page locks as well? Are there ways to work out why a particular query that is only touching a small set of rows would use a table lock, I’m guessing it’s lock escalation.