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 1vN7HZ-00BTVz-1s for pgsql-docs@arkaria.postgresql.org; Sun, 23 Nov 2025 10:25:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vN7HW-00E8ae-0R for pgsql-docs@arkaria.postgresql.org; Sun, 23 Nov 2025 10:25:22 +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 1vN7HV-00E8aW-2k for pgsql-docs@lists.postgresql.org; Sun, 23 Nov 2025 10:25:22 +0000 Received: from mail-yw1-x112e.google.com ([2607:f8b0:4864:20::112e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vN7HT-0012vK-32 for pgsql-docs@lists.postgresql.org; Sun, 23 Nov 2025 10:25:21 +0000 Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-787e7aa1631so50146757b3.1 for ; Sun, 23 Nov 2025 02:25:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763893518; x=1764498318; darn=lists.postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=eOzK15IxElE9SE7tq3bQqZGfVqXNzO3dGSp4SnDAKu0=; b=VrJ4qr8iPd+K/AXLEFSgK76bqGEpainBlq/JCv6TlWo26AkrY/rqZD4J742TvRYK78 EceSNUY1f0zadmVwyYxhZIIpvA6yzU36+4Jr8Ig1dLFbCyWBwxWs8JzEKn0WWBah6Vc1 9Ucr7mPbqt+PmPUpj5DUvzrW1f/IYc27cfY6d2tWU4BEIQnTbnAvYqQyCrue5WXgXjVG ig8oIDYHoOBfdwn0x7G+gjJQo3jNRzeH4Ly58C+O8SRb5FR1nARHAW7N67RMjr1cxSDD qmHzVJce1kxbSUfhxTp0rjYf+RGhhRpXKFqs3tVPnY8QF15k9cIOFg8YB0E6tQ+lor4i VR+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763893518; x=1764498318; h=to:subject:message-id:date:from:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=eOzK15IxElE9SE7tq3bQqZGfVqXNzO3dGSp4SnDAKu0=; b=RLinAVXGAywhQUCu3B+Jt6PuJTOEqB6cYpY45/jN2a94PCMv4Yol5lnFn9CMqI01KI az4/E46CFBRjkm+tsHQoZvdXdhIH6+V75OV3gJZ3xWfK8GCHqcUZ3PwrNdWWqrgRGAeq 6KLODkxBX0nhsI7YNNlz1f/Te0TJaFXH0qeAmMraIpFVYezpq5Lhvwt2jUn6Mro0IgSn sTuTcyaEa3aEefAsbfjZxrMUy5XgybjOANe6x0hieRKHI/9cXMMTWfRApZH0NPMKhARU QzUWyM+B9rJHxRngPr1kdzVYIADSjZ/cqD6RfiBuGko/abPBW3r2bKfbFwuYxd63CeYz YOVw== X-Gm-Message-State: AOJu0YxWMYd2eIHf4I0qwkq3p0O4YdiRkm5Eu7kxup8JSo0KosIm/Q0C tI7/tytnLrpGlqZ2188mirLIeqazLssSZLdxCnesQKkMasoOBR9lio6g+JUdxlRwm6GOurRPDyV YeEyt7bqpmLdlnW1itNo7SQGb51s3OHYT/K5b X-Gm-Gg: ASbGncu/WpNipl6kkmZNyngPZdSiAfPmxUNr/Efo54AnRzdz3IxK/EPl757kWHut14a mJpFA/gOVnAETFKFCME6eGyXj7/6YV2wfGqhiuOf2CQtyG8TEQ7qIzp6NiNQInPo4KX/8RePxkv M3wKH0VCEBlE4wI24Q0VYNq5Makm5i5rj+iATsjaaF9adxVw2jFukIUR3uVXHdldE4bjkBW/JJy nohncpAcGQN6zWzsCQBRSLqnwbjcYehmLdQ99kTCbPQE1PxArlDgP3mtiQkADxbLFP5w3+8GMNs Ea9+dWXGYs3SGIU/Crwr X-Google-Smtp-Source: AGHT+IFHmCuL+gx/1Jw6XU1QCKHYve4jEdSDrkWP3xjJG0JBVKPoBpo1rKz0qXMktQVJGe8A5kKoMZC3q+XxKzZ96IQ= X-Received: by 2002:a05:690e:1918:b0:63f:ae23:b5e6 with SMTP id 956f58d0204a3-642f8e2dbafmr8768049d50.26.1763893517817; Sun, 23 Nov 2025 02:25:17 -0800 (PST) MIME-Version: 1.0 From: Bernice Southey Date: Sun, 23 Nov 2025 10:24:42 +0000 X-Gm-Features: AWmQ_bm4o47C7n9rP36HJvMn4TSbzuCTFjXT3UAmbLNF51MY9CGseIlRALbKQTE Message-ID: Subject: More guidance on ctid To: pgsql-docs@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, I'm wondering if the explanation of ctid in System Columns should have more guidance - especially as it's used in examples in the UPDATE and DELETE docs. So far I've been caught out by partitions and concurrent updates. This was after I changed primary keys to ctid, in self-joins that get ORDER BY or LIMIT, for UPDATE and DELETE. I'm too unsure about this idea and my knowledge of ctid to propose a patch, but FWIW, here's my attempt: Ctid is useful for removing duplicate rows and efficient self-joins. Be aware that when ctid is used to find a row, only the first concurrent write will be applied. Also note that ctids are not unique across table partitions. I'm learning my way through ctid, and the mailing lists, and am still in the foothills of both. Sorry about the topic-adjacent duplicates in other lists from my ramblings. Thanks, Bernice