{"schema": "pgtrue.report/1", "url": "https://pgtrue.postgres.ai/shared/brief/f01d0141-796c-4a87-a3bf-3ec19aa9cc7d", "published": "2026-10-21T03:56:36Z", "publisher": "PostgresAI", "article": {"title": "Troubleshooting row lock contention in Amazon Aurora PostgreSQL: Part 1 \u2013 Understanding row lock contention in PostgreSQL | Amazon Web Services", "url": "https://aws.amazon.com/blogs/database/troubleshooting-row-lock-contention-in-amazon-aurora-postgresql-part-1-understanding-row-lock-contention-in-postgresql", "date_published": "2026-09-14T16:02:08Z", "author": "Sameer Kumar and sabesan manivasakan", "publisher": "AWS Database Blog"}, "grade": "A", "axes": [{"axis": "Factual", "summary": "A \u00b7 0 wrong of 12 checked \u00b7 0 caveats"}, {"axis": "Applicable", "summary": "A \u00b7 0 wrong of 5 checked \u00b7 0 caveats"}, {"axis": "Consistent", "summary": "A \u00b7 0 wrong of 12 checked \u00b7 0 caveats"}, {"axis": "Transparent", "summary": "0 wrong \u00b7 0 caveats \u00b7 2 checked"}, {"axis": "Safe", "summary": "not applicable"}], "findings": [{"anchor": "F2", "url": "https://pgtrue.postgres.ai/shared/brief/f01d0141-796c-4a87-a3bf-3ec19aa9cc7d#F2", "claim": "\u2026view combined with the pg_blocking_pids() function shows lock relationships between sessions\u2026", "title": "Session activity and blocker discovery support the monitoring query", "explanation": "pg_stat_activity supplies the selected session fields. pg_blocking_pids() identifies incompatible lock holders and conflicting waiters ahead in the queue. system_views.sql:894-900 defines the activity fields. lockfuncs.c:553-554 emits blocking process IDs.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/func.sgml#L25002-L25005", "label": "REL_18_6 \u00b7 doc/src/sgml/func.sgml:25002-25005"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/catalog/system_views.sql#L894-L900", "label": "REL_18_6 \u00b7 src/backend/catalog/system_views.sql:894-900"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/lockfuncs.c#L553-L554", "label": "REL_18_6 \u00b7 src/backend/utils/adt/lockfuncs.c:553-554"}]}, {"anchor": "F3", "url": "https://pgtrue.postgres.ai/shared/brief/f01d0141-796c-4a87-a3bf-3ec19aa9cc7d#F3", "claim": "\u2026not the individual row locks stored in data pages\u2026", "title": "The transaction-ID query does not enumerate tuple-header locks", "explanation": "pg_locks normally represents a row-lock wait through the holder's transaction ID. It does not enumerate every locked tuple. system-views.sgml:1916-1921 documents this distinction. The article's transaction-ID filter matches that behavior.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/system-views.sgml#L1916-L1921", "label": "REL_18_6 \u00b7 doc/src/sgml/system-views.sgml:1916-1921"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/catalog/system_views.sql#L397-L398", "label": "REL_18_6 \u00b7 src/backend/catalog/system_views.sql:397-398"}]}, {"anchor": "F4", "url": "https://pgtrue.postgres.ai/shared/brief/f01d0141-796c-4a87-a3bf-3ec19aa9cc7d#F4", "claim": "\u2026SELECT pg_backend_pid(), txid_current();\u2026", "title": "The identifier query returns the current backend and transaction", "explanation": "pg_backend_pid() returns MyProcPid in pgstatfuncs.c:692. txid_current() returns the current top-level transaction ID. It assigns an ID when necessary. The article uses both functions consistently with their documented meanings.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/pgstatfuncs.c#L689-L693", "label": "REL_18_6 \u00b7 src/backend/utils/adt/pgstatfuncs.c:689-693"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/func.sgml#L27810-L27814", "label": "REL_18_6 \u00b7 doc/src/sgml/func.sgml:27810-27814"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/func.sgml#L27560-L27564", "label": "REL_18_6 \u00b7 doc/src/sgml/func.sgml:27560-27564"}]}, {"anchor": "F5", "url": "https://pgtrue.postgres.ai/shared/brief/f01d0141-796c-4a87-a3bf-3ec19aa9cc7d#F5", "claim": "\u2026logs lock wait events that exceed deadlock_timeout (default 1 second)\u2026", "title": "Enabled lock-wait logging uses the deadlock timeout", "explanation": "log_lock_waits reports waits after deadlock_timeout. The default delay is 1,000 milliseconds in guc_tables.c:2266-2274. proc.c:1592 gates reporting on enabled logging and the deadlock check. proc.c:1653-1656 also logs eventual acquisition.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/config.sgml#L8041-L8044", "label": "REL_18_6 \u00b7 doc/src/sgml/config.sgml:8041-8044"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/misc/guc_tables.c#L2266-L2274", "label": "REL_18_6 \u00b7 src/backend/utils/misc/guc_tables.c:2266-2274"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/storage/lmgr/proc.c#L1588-L1592", "label": "REL_18_6 \u00b7 src/backend/storage/lmgr/proc.c:1588-1592"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/storage/lmgr/proc.c#L1653-L1656", "label": "REL_18_6 \u00b7 src/backend/storage/lmgr/proc.c:1653-1656"}]}, {"anchor": "F6", "url": "https://pgtrue.postgres.ai/shared/brief/f01d0141-796c-4a87-a3bf-3ec19aa9cc7d#F6", "claim": "\u2026pgrowlocks performs a full table scan\u2026", "title": "pgrowlocks scans the table to inspect row locks", "explanation": "pgrowlocks reads rows sequentially to collect lock information. pgrowlocks.c:116-124 starts the scan and repeatedly fetches tuples. pgrowlocks.sgml:93-95 warns about large-table cost. The article correctly warns against unrestricted production scans.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/pgrowlocks.sgml#L93-L95", "label": "REL_18_6 \u00b7 doc/src/sgml/pgrowlocks.sgml:93-95"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/pgrowlocks/pgrowlocks.c#L116-L124", "label": "REL_18_6 \u00b7 contrib/pgrowlocks/pgrowlocks.c:116-124"}]}, {"anchor": "F7", "url": "https://pgtrue.postgres.ai/shared/brief/f01d0141-796c-4a87-a3bf-3ec19aa9cc7d#F7", "claim": "FOR UPDATE serves as the most restrictive mode\u2026", "explanation": "FOR UPDATE conflicts with all four row-lock modes. FOR NO KEY UPDATE permits FOR KEY SHARE. REL_18_6 src/backend/access/heap/README.tuplock:65-69 gives this conflict table. This verifies the mode ordering, not the displayed UPDATE execution.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/heap/README.tuplock#L65-L69", "label": "REL_18_6 \u00b7 src/backend/access/heap/README.tuplock:65-69"}]}, {"anchor": "F8", "url": "https://pgtrue.postgres.ai/shared/brief/f01d0141-796c-4a87-a3bf-3ec19aa9cc7d#F8", "claim": "\u2026stores lock information directly in the row\u2019s internal system column ( xmax )\u2026", "title": "Tuple headers store persistent row-lock information", "explanation": "heapam.c:5387-5393 writes lock flags and xmax into the tuple header. Ordinary row locks need no shared-memory entry per locked row. After marking the tuple, heapam.c:5480-5485 releases the heavyweight tuple lock if acquisition required one.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/heap/heapam.c#L5387-L5393", "label": "REL_18_6 \u00b7 src/backend/access/heap/heapam.c:5387-5393"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/heap/heapam.c#L5480-L5485", "label": "REL_18_6 \u00b7 src/backend/access/heap/heapam.c:5480-5485"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/mvcc.sgml#L1353-L1355", "label": "REL_18_6 \u00b7 doc/src/sgml/mvcc.sgml:1353-1355"}]}, {"anchor": "F10", "url": "https://pgtrue.postgres.ai/shared/brief/f01d0141-796c-4a87-a3bf-3ec19aa9cc7d#F10", "claim": "\u2026In another session, trying to update the same row would hang waiting for a row lock\u2026", "title": "The second update waits for the open transaction", "explanation": "The second UPDATE waits while the first transaction holds the conflicting row lock. PostgreSQL 18 explicit-locking documentation confirms this behavior. This verifies the blocking explanation, not the recorded session identifiers.", "verdict": "Accurate", "sources": [{"url": "https://www.postgresql.org/docs/current/explicit-locking.html", "label": "https://www.postgresql.org/docs/current/explicit-locking.html"}]}, {"anchor": "F12", "url": "https://pgtrue.postgres.ai/shared/brief/f01d0141-796c-4a87-a3bf-3ec19aa9cc7d#F12", "claim": "\u2026PostgreSQL will also record when a waiting session is able to acquire the lock\u2026", "explanation": "REL_18_6 src/backend/storage/lmgr/proc.c:1653-1656 logs acquisition when myWaitStatus equals PROC_WAIT_STATUS_OK within the logging block. The message includes elapsed milliseconds. This verifies the successful-acquisition message format, not the example's recorded elapsed time.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/storage/lmgr/proc.c#L1630-L1695", "label": "REL_18_6 \u00b7 src/backend/storage/lmgr/proc.c:1630-1695"}]}, {"anchor": "F13", "url": "https://pgtrue.postgres.ai/shared/brief/f01d0141-796c-4a87-a3bf-3ec19aa9cc7d#F13", "claim": "Querying pg_stat_activity and pg_locks requires constant monitoring\u2026", "title": "Historical lock analysis requires collecting view contents", "explanation": "pg_stat_activity describes current process activity. pg_locks describes active locks. PostgreSQL 18.6 documents those scopes in monitoring.sgml:714 and system-views.sgml:1665. Historical analysis requires retaining observations over time.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/monitoring.sgml#L713-L717", "label": "REL_18_6 \u00b7 doc/src/sgml/monitoring.sgml:713-717"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/system-views.sgml#L1657-L1736", "label": "REL_18_6 \u00b7 doc/src/sgml/system-views.sgml:1657-1736"}]}, {"anchor": "F14", "url": "https://pgtrue.postgres.ai/shared/brief/f01d0141-796c-4a87-a3bf-3ec19aa9cc7d#F14", "claim": "\u2026deadlock_timeout (default 1 second)\u2026", "title": "deadlock_timeout defaults to one second", "explanation": "PostgreSQL 18.6 defines deadlock_timeout as 1,000 milliseconds by default. src/backend/utils/misc/guc_tables.c:2269 specifies milliseconds. Line 2272 sets the default to 1,000.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/misc/guc_tables.c#L2266-L2274", "label": "REL_18_6 \u00b7 src/backend/utils/misc/guc_tables.c:2266-2274"}, {"url": "https://www.postgresql.org/docs/current/runtime-config-locks.html", "label": "https://www.postgresql.org/docs/current/runtime-config-locks.html"}]}, {"anchor": "F15", "url": "https://pgtrue.postgres.ai/shared/brief/f01d0141-796c-4a87-a3bf-3ec19aa9cc7d#F15", "claim": "Throughput dropped to approximately 4,900 transactions per second, a 55 percent reduction\u2026", "title": "The stated throughput rates imply a 55% reduction", "explanation": "Throughput falls by 55.0% (derived: 100 \u00d7 (10,900 \u2212 4,900) / 10,900). The remaining throughput is 45.0% of baseline. Both percentages match the article's rounding.", "verdict": "Accurate", "sources": []}]}