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 1vYUp7-0058Ie-28 for pgsql-docs@arkaria.postgresql.org; Wed, 24 Dec 2025 19:47:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vYUp6-005S3k-1Q for pgsql-docs@arkaria.postgresql.org; Wed, 24 Dec 2025 19:47:05 +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 1vYUp6-005S3c-0f for pgsql-docs@lists.postgresql.org; Wed, 24 Dec 2025 19:47:04 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vYUp5-002RZo-1Q for pgsql-docs@lists.postgresql.org; Wed, 24 Dec 2025 19:47:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=momjian.us; s=2025010100; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description; bh=ShystNrsHNg8hoQm/a1zG9j8G8CapW/Y5V/0P8KenVc=; b=IMgd+ q2bIVGl//z9Z3J2qkhNlq6jEPGPmG4LPMLZwrmwnl+YS0Z1Hz9ILOc0zk+16jHbtJNOc2w6rRC+UI KJMPjnRZBdjIpurK5AuWdgc/ZQnqMvh2EzGgU/12wFYRKJlqEwQsxs2Orl+neDo0+rCtuJ8NJ9vME d5B2q0ACEQCacZM7eFGsSS21lS3+nIApQlK734APVozZ+nKiSi+QlUM9EpEcQynxVRgtazd2KQdAD ewbX96JmmvXlSk+TUfHztYyS5fiOMiR1TTcMlBf8HbC6waDg2IF7+thUi2TAg/fyByHprQVWUysyl xZNpqodWzoRvB18D4aTcq1b7UIPGQ==; Received: from bruce by momjian.us with local (Exim 4.98.2) (envelope-from ) id 1vYUp3-00000007gFI-2FEn; Wed, 24 Dec 2025 14:47:01 -0500 Date: Wed, 24 Dec 2025 14:47:01 -0500 From: Bruce Momjian To: Bernice Southey Cc: pgsql-docs@lists.postgresql.org Subject: Re: More guidance on ctid Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Dec 24, 2025 at 07:38:07PM +0000, Bernice Southey wrote: > Bruce Momjian wrote: > > We could go in the direction you suggested, but it seems out-of-place in > > the UPDATE/DELETE docs since it gets into a lot of details. Maybe in > > the locking chapter? > How about if the UPDATE and DELETE examples only show how to get limit > and order by with a cte, and remove all references to locking. No for > update, deadlocks etc. The examples use primary keys and not ctid. > Anyone just trying to do simple limit and order by without locking > problems will get what they need, and won't be confused by the locking > complexity. Anyone trying to solve lock contention needs to understand > locking and should be looking at that chapter. The explanation for > deadlock avoidance should be there as you suggest. Perhaps the update > and delete examples can link to them. If you think this is the right > approach I'm willing to give it a go? I am not the author of the original ctid doc patch, but I believe the goal was to use ctid so we don't need to use needless index lookups for primary keys. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Do not let urgent matters crowd out time for investment in the future.