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.94.2) (envelope-from ) id 1twSrh-00EojW-RW for pgsql-hackers@arkaria.postgresql.org; Sun, 23 Mar 2025 21:28:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1twSrf-005wYe-PK for pgsql-hackers@arkaria.postgresql.org; Sun, 23 Mar 2025 21:28:15 +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.94.2) (envelope-from ) id 1twSrf-005wWZ-FH for pgsql-hackers@lists.postgresql.org; Sun, 23 Mar 2025 21:28:15 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1twSrd-000k6c-01 for pgsql-hackers@lists.postgresql.org; Sun, 23 Mar 2025 21:28:15 +0000 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-543e4bbcd86so3981470e87.1 for ; Sun, 23 Mar 2025 14:28:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742765290; x=1743370090; darn=lists.postgresql.org; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=1MhYlUYm2c86W7O7SqfiEiPNWDjFnn6PTbGLaXiJoSg=; b=LAw19o9ngyTI8veRz8c88C1b6kM8pYAiqKmkgcBC0GJPxB4kK2+aSrXtatHYN+2b+5 zMgHZV5njmoETL54FD+ukwhFSKb3N6YSzxtVS9TW5QidgccD61oFl2IkuNELxskU0X7a sC6MmLUn0fCAMV51m4I3DGt94Q+sF1SDDrhFmwLpFBP2qyGpiZUoh9cQbXhWxZ1Sh3Gc hfriNCoiG2pS8W46BjX84hsNMAxStKGHUOxDjiw4jcZw4F2Z9JU9WrcDxygX9+VF6Clh hX3iBCvdhn74iti8SEBaJahdT4AYITCA/QsfS6zrzxmEVMP9oMIkHADi2I3wztpekD8b 9zaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742765290; x=1743370090; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=1MhYlUYm2c86W7O7SqfiEiPNWDjFnn6PTbGLaXiJoSg=; b=WUm8NJqMFS4b5VDnc+bRUonHDHwSKX927npovKiMNDGrNKt+/gxiAxvENfKn+bnLh/ SLOuZfnT9QXMOkrw7cU7KMAlm9EMsgllJA6PYyzUkqY2Xtdxs3qVdGemdzU3EgVtBT6G XCIRA0YksFPnU5arVNoCrhECnuMhvjW350JZ1deHeHMHDdbP9cN18W/ftsck664snHpw HW+GQRhb2LOB/8m0Os9gga5qoRrnWL1MLFhCLxKt2lI4QgkoHNhTxxtLK1ov925KUcVk ghE8apXWkLT0I42kZBSKbOyBwac05AsEK/abhoK1snp/2g0EGqo22mzSMFn+EoGpiQ4E /vVQ== X-Gm-Message-State: AOJu0YwaZ9+qgd0TcSOz9NW3iMjMBULzihCKIa1CRlVT7eahkx89cTe9 00K9Qp5ja1OwPprLlTIDjg9S2ugyo78udBS6NWU/aDKhIleA1BR8AEaxEPkD6zHKnp3YiJtDHK/ /wiXJu5rfRB0kRCm350vOTOIznTmnuskG X-Gm-Gg: ASbGnctiEDTeRPl7Kql1lRzVw2C9uLxl1H6qwQOPMq2KDOtWPejz2O8+nXtIdWWk2Se XDyfSg1472CQu8JDaQ3UhJJJPWIpfkdM5CaGrp2uadpM4XHMKlgHkNPCj04FRrXMSrXpS7CMAIe 6x2e45QURvwjHrMbwjZ9DrdkpYTiawGlmXNW6neaYkRk8FXLRG61ngNYtOeqo= X-Google-Smtp-Source: AGHT+IFVZu4kOraRwt20RTN/eP0nAjcPbfQxMQK+xTQWMMGLYCrDXKS6oTWsrlh+pozghvtbLX+/BjrlREhQnQo85tI= X-Received: by 2002:a05:6512:68d:b0:549:8f24:b617 with SMTP id 2adb3069b0e04-54ad6470ad5mr3671092e87.4.1742765289906; Sun, 23 Mar 2025 14:28:09 -0700 (PDT) MIME-Version: 1.0 From: David Rowley Date: Mon, 24 Mar 2025 10:27:58 +1300 X-Gm-Features: AQ5f1Jo2t-R0o_xSyEgF2b3mj3uJZXz0j0Xwnlseg1Xg-1Zqk0INJhcipWa-J2I Message-ID: Subject: Add mention in docs about locking all partitions for generic plans To: PostgreSQL Developers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Over in [1], there was some uncertainty about whether locking an unrelated partition was expected behaviour or not for the particular use-case which used a generic plan to scan a partitioned table and all of the partitions. I noticed that we don't mention this in the docs and though that perhaps we should. I thought a good place might be in [2] at the end of the following paragraph: "During initialization of the query plan. Partition pruning can be performed here for parameter values which are known during the initialization phase of execution. Partitions which are pruned during this stage will not show up in the query's EXPLAIN or EXPLAIN ANALYZE. It is possible to determine the number of partitions which were removed during this phase by observing the =E2=80=9CSubplans Removed=E2=80= =9D property in the EXPLAIN output." Perhaps adding something like "Because all relations which are part of the plan are locked at the beginning of execution, any partitions pruned at this stage are already locked and will remain so until the end of the transaction.". or: "It's important to note that any partitions removed by the partition pruning done at this stage are still locked at the beginning of execution". This is no longer true in master, so if we do something here it's only v17 and earlier. Does anyone else have an opinion on this? David [1] https://postgr.es/m/01020195b987abd3-a008b77d-8c63-4931-80a4-be36a351c8= b2-000000@eu-west-1.amazonses.com [2] https://www.postgresql.org/docs/17/ddl-partitioning.html