Dhruv Gairola
Dhruv Gairola

Reputation: 9182

AWS RDS- Lock:transactionid vs Lock:tuple difference?

I was checking the documentation for AWS RDS (along with the performance insights for my DB) and I saw that lock:transactionid and lock:tuple have 2 separate descriptions. However it's not clear to me what the difference is because rows and tuples mean the same thing in the DB. So why does RDS have 2 separate ways to describe the same thing?

Upvotes: 7

Views: 2750

Answers (1)

SteWood
SteWood

Reputation: 11

Might be too late for this to be relevant for the OP but for anyone googling this it is to do with transaction vs tuple context.

  • Lock:transactionid = Waits on a lock held by a transaction with lock info available in memory. The blocking transaction might also hold other locks than just the one on this tuple.
  • Lock:tuple = This is the row/tuple level lock you think it is. It's just that in views like pg_locks you are more likely to see the transactionid locks as the tuple-level lock info is usually held on disk.

"Although tuples are a lockable type of object, information about row-level locks is stored on disk, not in memory, and therefore row-level locks normally do not appear in this view. If a process is waiting for a row-level lock, it will usually appear in the view as waiting for the permanent transaction ID of the current holder of that row lock."

from https://www.postgresql.org/docs/17/view-pg-locks.html

Upvotes: 1

Related Questions