Associated_Object_Id in Extended Events

Mikhail Firsov 1,881 Reputation points
2022-07-18T10:47:19.097+00:00

Hello,

I've already asked that question here but maybe I still don't understand anything so please explain it to me once again:

For example, here's the screenshot of the target date of the the lock_acquired extended event:
221759-objectid.png

Q: Is the value in the Associated_Object_Id really some object_id? I thought all objects in SQL Server had object_ids that could be found in sys.objects (except triggers...), but there's no object with such id on my server:
221883-objectid-2.png

???

Regards,
Michael

SQL Server | Other
0 comments No comments
{count} votes

Answer accepted by question author
  1. Erland Sommarskog 129.6K Reputation points MVP Volunteer Moderator
    2022-07-18T11:27:57.373+00:00

    If you look in the documentation for sys.dm_tran_locks you find this description for resource_associated_entity_id:

    ID of the entity in a database with which a resource is associated. This can be an object ID, Hobt ID, or an Allocation Unit ID, depending on the resource type

    The id will be an object ID if the lock is on table level. For a lock on page or row level, it will be the allocation unit ID for the index (partition) in most cases, but it can also be in a LOB area.

    If you want to know the full rules for how to translated, have a look at the code of my beta_lockinfo where I do this work. (Search for sys.allocation_units to find the part where I do this.)

    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Mikhail Firsov 1,881 Reputation points
    2022-07-18T11:57:34.157+00:00

    Thank you very much for the explanation, ErlandSommarskog!

    Regards,
    Michael

    0 comments No comments

  2. Mikhail Firsov 1,881 Reputation points
    2022-07-18T11:58:56.5+00:00

    ...and thank you for your beta_lockinfo!

    0 comments No comments

  3. Mikhail Firsov 1,881 Reputation points
    2022-07-18T12:03:19.523+00:00

    P.S. "If you look in the documentation for sys.dm_tran_locks you find this description for resource_associated_entity_id" - even if had looked at it earlier I couldn't be sure the Associated_Object_Id = resource_associated_entity_id - that's the main problem in documentation :(


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.