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 1vYR25-003PeT-2I for pgsql-docs@arkaria.postgresql.org; Wed, 24 Dec 2025 15:44:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vYR24-0055SI-25 for pgsql-docs@arkaria.postgresql.org; Wed, 24 Dec 2025 15:44:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vYR24-0055SA-1L for pgsql-docs@lists.postgresql.org; Wed, 24 Dec 2025 15:44:13 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vYR22-002Xi8-2s for pgsql-docs@lists.postgresql.org; Wed, 24 Dec 2025 15:44:12 +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=pHeanJeWp9em0K7zvlyGoKAOF5lgGvxkFWZR5ycL8k4=; b=Iefd2 9HHbXUPkzyliIGD1sHnLYbnXbdWnDH0P6eWV20JVwGmQJfSYu+UmpJrjXhDmY1mC+ZpNsjZ3NWBqm EpQautd8DwvRM48yN1E20ukHw+z2hvySdISE6qmT+a0ojm67Y9vaQD1giF07OtRqbk7fqkx3o4TGy O27Z5sS3/W+CthYYGs+qSPI/ZvhLosT7iIqxeVnNen5un/Xdab7Sf5uxo5M9/feOrBEV/eZMFnzZR +bLAlB9MNxpdCYiF+ESfrzTMPoWQ2xnejeSb6TDWLtKJ2cN2Sg5PMlBuhUJ61g0RDP1hPv7SzxE3S AjitA3jBiId4oA7jkcDg/SbwrdiVQ==; Received: from bruce by momjian.us with local (Exim 4.98.2) (envelope-from ) id 1vYR20-000000077H8-47hf; Wed, 24 Dec 2025 10:44:08 -0500 Date: Wed, 24 Dec 2025 10:44:08 -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 03:26:23PM +0000, Bernice Southey wrote: > > Okay, let's give it another 12 hours and I will apply it tomorrow, > > thanks. > I had a new thought. Perhaps the root problem is trying to put too > many things into one example. We can use the two examples to show > different things. > > I've kept batching - with skip lock, limit and ctid - in DELETE. Other > than switching out skip lock for order by, this is much the same as > currently, but with all the existing update explanatory text moved > here. Skip lock makes ctid safe, and this is a good use of it. > > I've used UPDATE to show how to prevent deadlocks with order by, for > update, and an immutable key. This meant explaining why an immutable > key matters, conveniently ruling out ctid without even mentioning it. > > I think this now covers how to order by and limit with update and > delete, how and why to batch, how to safely avoid deadlocks, how to > use for update (with and without skip lock) and when and when not to > use ctid. > > But if you don't like this approach, I'm still happy if you go with > your patch. I expect my patch needs quite a bit more work, even if you > do like it. 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? -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Do not let urgent matters crowd out time for investment in the future.