Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vdxOw-0078WT-29 for pgsql-docs@arkaria.postgresql.org; Thu, 08 Jan 2026 21:18:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vdxOv-004Qed-1j for pgsql-docs@arkaria.postgresql.org; Thu, 08 Jan 2026 21:18:38 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vdxOv-004QeP-0m for pgsql-docs@lists.postgresql.org; Thu, 08 Jan 2026 21:18:38 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vdxOt-004xPT-0m for pgsql-docs@lists.postgresql.org; Thu, 08 Jan 2026 21:18:36 +0000 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-47775fb6cb4so20629345e9.0 for ; Thu, 08 Jan 2026 13:18:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1767907112; x=1768511912; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=xfPTsImiBWF/IiASHf0lXVSb/ppooTkSJ1crFoPnkK4=; b=GfWC2J/l2346iXuXIT0oZHdE36OkEuxxi27x7QybtKXLh2rmVbMqxppG4JN1nBM8On QPwoSfPnA7cFX2Wb0Pt/2X5Ymh2wIPl68CKroJn1gKzBMqfpTbu/7HQK5zerYrVfVLjj SVT2QTR4yFFL8XIRJK7LovkTxDkm0MCSHIGnrXaeuGXFjIRumjqVAqIjicAvt4EaL90R 8G/Ex7PkIbGWCY8OJKfNzjP+sg3BydJlUBUGohox81hzrTYrz5fKBHOyzHIwlFJNAmTR +HBujBPpH5w8ar11rByBHDFilxOY9zF8RccO8im0VnSifk/qFJZERfNuEzgrc0gqWbJK hwvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767907112; x=1768511912; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xfPTsImiBWF/IiASHf0lXVSb/ppooTkSJ1crFoPnkK4=; b=APGTk0YUElL4IrdfVt5eCCmHdeYCUu/59GRJKFgHrY8U78sv0/Jo6j75mZ0W36tMFP pc+3hAA5x9iejoBvlJcX2hGedbAM0JJHww2vd5f0NV4ONe9vuyr+tSHLMSRpBHRT80t5 eCZZTWdxxAGs6L1i8cdIvsNkR6cQisMwWHA58YHRf1hmwDSbmI9UNrKQ1mTxoQuBl5C4 8e30W8KoW/7X7NdtvQDVE6qH5iS9EKZ7dCTexKCo3kVJpotK9OH7Uo+kTfdvTslLB0G3 Dz9rWmPRgS2J+GvVg7LvM8FtIaKCigqKJ48FLloxAZ4bJqFm4VYT9LSZi2GX9wKW0Kad uGXg== X-Forwarded-Encrypted: i=1; AJvYcCXmY/ZWB//ZNu6k+Uvvr7UtvesqN3BIInY4dDK60FAHBYUpHCsgJ8xUb0KVyzgotZ8Pu3euuInSjSC4@lists.postgresql.org X-Gm-Message-State: AOJu0YyNIOiEiZF6icbWOYBsXpt+DsujlvKizz4el7kGr5WfrZfIGpgv Vbuk8JfmvnPlufyHVx5+kqfzRFXeHCjRnBDj7brY0NqaBo3cWIfpCt8mPWGNnvlVC5g= X-Gm-Gg: AY/fxX68VK3UqoIzyCfU4I+5fL6Oiq7TxoUyHiNKyKdk76WTnUuStusWFAXm4TxjOAM ei0cwGD8LxCZb1CF2JLZmaaNZREJdQCcTt6c+k6JakJwbOJ8vqd6SffOIFogeqpgN2zx4fHVjGo IpsEKcQrzX60kkWr/TUxSRL2ZF1gmcYlNlz1e4SKc8y2FFJxp/BzEcSn0GSaYSmWMX4tgtrm92M VXB4MSS+QrIwSDnfHg006jSn+hC6Q4xAD6xcinzFh88xxpReR2L1Zb56K22JjWGPl15LdkqLKvK 9UGqmDCMxh/LMyhPwwHjfdsYGCx05a5hGMYgH/PFk94qTXXCx0V++JsOB8fj5fN8uwQSvdsylJ5 +ayTW7dHE0S3aKzP/ACSJIrUIuglC8m5SfKMZGObUN/p22Mi0a9atFxpOHIWw9ErIyCdwa3Kc5z wFc4px5YAeJ74v21nk6fWHdHyKu8oh9Uj/kYRs16GbOg== X-Google-Smtp-Source: AGHT+IFyYeJnZuMtvLYShzikfdb/XDjJjVIvxrB3yGJQqer37TpQYs3HYKI/r2qmYFJupHLiOesfDQ== X-Received: by 2002:a05:600c:8b6d:b0:47a:814c:eea1 with SMTP id 5b1f17b1804b1-47d84b4a7b4mr89745355e9.35.1767907111759; Thu, 08 Jan 2026 13:18:31 -0800 (PST) Received: from laurenz.albe-K4N0CV00F97414D ([2001:871:260:e83b:cde4:8177:a48f:f3db]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47d8661caffsm45640545e9.5.2026.01.08.13.18.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jan 2026 13:18:31 -0800 (PST) Message-ID: <0018b6c34edba1360c618266c58292f9ff88e2f0.camel@cybertec.at> Subject: Re: Is this paragraph in the pg_locks section still correct/accurate? From: Laurenz Albe To: "Daniel Westermann (DWE)" , PostgreSQL-documentation Date: Thu, 08 Jan 2026 22:18:30 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.2 (3.58.2-1.fc43) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 2026-01-08 at 09:49 +0000, Daniel Westermann (DWE) wrote: > while playing a bit with pg_locks I came across this: >=20 > https://www.postgresql.org/docs/current/view-pg-locks.html >=20 > "Although tuples are a lockable type of object, information about row-lev= el 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 transact= ion ID of the current holder of that row lock." >=20 > Given this? (I've just updated the same row in two transactions): >=20 > postgres=3D# select locktype,database::regdatabase,relation::regclass,pid= ,mode,granted,waitstart,page,tuple from pg_locks where pid !=3D pg_backend_= pid() order by pid; > locktype | database | relation | pid | mode | granted = | waitstart | page | tuple=20 > ---------------+----------+----------+------+------------------+---------= +-------------------------------+------+------- > relation | postgres | t | 9673 | RowExclusiveLock | t = | | | =20 > virtualxid | | | 9673 | ExclusiveLock | t = | | | =20 > transactionid | | | 9673 | ExclusiveLock | t = | | | =20 > virtualxid | | | 9691 | ExclusiveLock | t = | | | =20 > transactionid | | | 9691 | ShareLock | f = | 2026-01-08 09:58:38.867534+01 | | =20 > tuple | postgres | t | 9691 | ExclusiveLock | t = | | 0 | 5 > transactionid | | | 9691 | ExclusiveLock | t = | | | =20 > relation | postgres | t | 9691 | RowExclusiveLock | t = | | | =20 > (8 rows) >=20 > ... I am wondering if that paragraph is still true or at least needs some= adjustments to explain what "normally" > and "usually" means? There clearly is information about the tuple and the= row level lock. A shared memory tuple lock is only taken if the row lock cannot be granted = right away, to guarantee that prospective lockers get served in a "first come, first served" fashion. As= soon as the row is locked, the heavyweight shared memory tuple lock is released again. The weasel words you mention are there to avoid having to go into too much = detail, without actively lying to the reader. My opinion is that whoever needs to understand this i= n detail should read heap_lock_tuple() in the source. Adding too much detail might confuse the average reader mor= e than it helps. Yours, Laurenz Albe