Reduce unnecessary locking of pruned partitions when reusing cached plans

Edit
ID 6216
Title Reduce unnecessary locking of pruned partitions when reusing cached plans
CI (CFBot) Summary
Stats (from CFBot) Patch version: v11, Patch count: 4, First patch: +155−21, All patches: +1044−92
Tags Performance
Created 2025-11-12 14:22:28
Last modified 2026-04-06 09:54:10 (6 hours ago)
Latest email 2026-04-04 12:10:37 (2 days ago)
Status
PG20-1 (2026-07-01 – 2026-07-31): Needs review
PG19-4 (2026-01-01 – 2026-01-31): Moved to different CF
Target version 19
Authors Amit Langote (amitlan)
Reviewers Become reviewer
Committer
Links
Emails
generic plans and "initial" pruning
First at 2021-12-25 03:36:00 by Amit Langote <amitlangote09 at gmail.com>
Latest at 2026-04-04 12:10:37 by Amit Langote <amitlangote09 at gmail.com>
Latest attachment (v4-0002-Introduce-ExecutorPrep-and-refactor-executor-star.patch) at 2025-11-25 08:31:04 from Amit Langote <amitlangote09 at gmail.com>
    Attachment (v4-0002-Introduce-ExecutorPrep-and-refactor-executor-star.patch) at 2025-11-25 08:31:04 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v3-0004-Use-pruning-aware-locking-in-cached-plans.patch) at 2025-11-20 07:30:26 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v2-0005-Make-SQL-function-executor-track-ExecutorPrep-sta.patch) at 2025-11-17 12:50:01 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v1-0003-Reuse-partition-pruning-results-in-parallel-worke.patch) at 2025-11-12 14:17:43 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v1-0001-Revert-Don-t-lock-partitions-pruned-by-initial-pr.patch) at 2025-05-21 10:22:03 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v2-0010-Partially-fix-some-extremely-broken-code-from-52.patch) at 2025-05-20 03:06:21 from Tom Lane <tgl at sss.pgh.pa.us> (Patch: Yes)
    Attachment (v1-0001-Fix-bug-in-cbc127917-to-handle-nested-Append-corr.patch) at 2025-02-23 08:35:49 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (0001-Fix-an-oversight-in-cbc127917-for-MERGE-handling.patch) at 2025-02-15 07:51:09 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v63-0001-Don-t-lock-partitions-pruned-by-initial-pruning.patch) at 2025-02-12 11:53:50 from Amit Langote <amitlangote09 at gmail.com> (Patch: No)
    Attachment (v62-0001-Track-unpruned-relids-to-avoid-processing-pruned.patch) at 2025-02-06 02:35:47 from Amit Langote <amitlangote09 at gmail.com> (Patch: No)
    Attachment (v61-0001-Track-unpruned-relids-to-avoid-processing-pruned.patch) at 2025-01-31 08:31:44 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v60-0002-Perform-runtime-initial-pruning-outside-ExecInit.patch) at 2025-01-23 07:15:48 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v59-0002-Initialize-PartitionPruneContexts-lazily.patch) at 2024-12-12 07:58:54 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (0005-Remove-the-need-to-check-if-plan-is-valid-from-Execu.patch) at 2024-12-09 07:10:24 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (pruning-in-ExecutorStart.diff) at 2024-12-06 08:18:47 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v58-0001-Move-PartitionPruneInfo-out-of-plan-nodes-into-P.patch) at 2024-12-05 12:03:09 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (xeon-complete.pdf) at 2024-12-01 18:36:21 from Tomas Vondra <tomas at vondra.me> (Patch: No)
    Attachment (v57-0002-Initialize-PartitionPruneContexts-lazily.patch) at 2024-10-25 12:30:24 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v56-0005-Handle-CachedPlan-invalidation-in-the-executor.patch) at 2024-09-20 08:10:03 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v55-0001-Move-PartitionPruneInfo-out-of-plan-nodes-into-P.patch) at 2024-09-19 12:10:04 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v54-0003-Defer-locking-of-runtime-prunable-relations-to-e.patch) at 2024-09-19 08:39:51 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v53-0001-Move-PartitionPruneInfo-out-of-plan-nodes-into-P.patch) at 2024-09-17 12:57:03 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v52-0001-Defer-locking-of-runtime-prunable-relations-to-e.patch) at 2024-09-05 09:55:47 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v51-0003-Handle-CachedPlan-invalidation-in-the-executor.patch) at 2024-08-29 13:34:17 from Amit Langote <amitlangote09 at gmail.com> (Patch: No)
    Attachment (v50-0002-Add-field-to-store-parent-relids-to-Append-Merge.patch) at 2024-08-15 12:57:40 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v49-0006-Add-field-to-store-parent-relids-to-Append-Merge.patch) at 2023-11-20 04:29:53 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v48-0007-Delay-locking-of-child-tables-in-cached-plans-un.patch) at 2023-09-28 08:26:27 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v47-0005-Teach-the-executor-to-lock-child-tables-in-some-.patch) at 2023-09-26 13:06:12 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v47-0005-Add-field-to-store-parent-relids-to-Append-Merge.patch) at 2023-09-06 09:12:28 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v46-0004-Make-ExecutorStart-return-early-upon-plan-invali.patch) at 2023-09-05 07:13:09 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v45-0006-Track-opened-range-table-relations-in-a-List-in-.patch) at 2023-08-11 05:31:03 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v44-0004-Set-inFromCl-to-false-in-child-table-RTEs.patch) at 2023-08-03 08:37:39 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v43-0002-Add-field-to-store-parent-relids-to-Append-Merge.patch) at 2023-08-02 13:39:45 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v42-0001-Add-field-to-store-parent-relids-to-Append-Merge.patch) at 2023-07-18 07:26:35 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v41-0001-Add-field-to-store-parent-relids-to-Append-Merge.patch) at 2023-07-13 12:58:38 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v40-0004-Track-opened-range-table-relations-in-a-List-in-.patch) at 2023-07-06 14:29:10 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v39-0004-Track-opened-range-table-relations-in-a-List-in-.patch) at 2023-06-08 14:23:21 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v38-0001-Add-field-to-store-partitioned-relids-to-Append-.patch) at 2023-03-27 14:00:38 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v37-0001-Add-field-to-store-partitioned-relids-to-Append-.patch) at 2023-03-27 08:18:20 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v36-0003-Track-opened-range-table-relations-in-a-List-in-.patch) at 2023-03-22 12:48:49 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v35-0003-Track-opened-range-table-relations-in-a-List-in-.patch) at 2023-03-14 10:07:41 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v34-0001-Move-AcquireExecutorLocks-s-responsibility-into-.patch) at 2023-03-02 13:52:53 from Amit Langote <amitlangote09 at gmail.com> (Patch: No)
    Attachment (v33-0001-Move-AcquireExecutorLocks-s-responsibility-into-.patch) at 2023-02-03 13:01:09 from Amit Langote <amitlangote09 at gmail.com> (Patch: No)
    Attachment (v32-0001-Move-AcquireExecutorLocks-s-responsibility-into-.patch) at 2023-02-02 14:49:58 from Amit Langote <amitlangote09 at gmail.com> (Patch: No)
    Attachment (v31-0001-Move-ExecutorStart-closer-to-GetCachedPlan.patch) at 2023-01-27 07:01:05 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v30-0002-In-GetCachedPlan-only-lock-unpruned-partitions.patch) at 2022-12-16 02:33:53 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v29-0001-Preparatory-refactoring-before-reworking-CachedP.patch) at 2022-12-14 08:35:47 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v28-0002-Add-root_parent_relids-to-PartitionPruneResult.patch) at 2022-12-05 06:08:09 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v27-0001-Optimize-AcquireExecutorLocks-by-locking-only-un.patch) at 2022-12-05 03:00:01 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v26-0002-Add-root_parent_relids-to-PartitionPruneResult.patch) at 2022-12-02 10:40:42 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v25-0001-Optimize-AcquireExecutorLocks-by-locking-only-un.patch) at 2022-12-01 12:43:28 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (PartitionPruneInfo-relids.patch) at 2022-12-01 07:59:25 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v24-0002-Optimize-AcquireExecutorLocks-by-locking-only-un.patch) at 2022-11-08 06:22:32 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v23-0001-Move-PartitioPruneInfo-out-of-plan-nodes-into-Pl.patch) at 2022-10-27 02:41:55 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v22-0001-Move-PartitioPruneInfo-out-of-plan-nodes-into-Pl.patch) at 2022-10-17 09:29:48 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v21-0001-Move-PartitioPruneInfo-out-of-plan-nodes-into-Pl.patch) at 2022-10-12 07:36:15 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v20-0001-Move-PartitioPruneInfo-out-of-plan-nodes-into-Pl.patch) at 2022-07-27 03:00:57 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v19-0001-Move-PartitioPruneInfo-out-of-plan-nodes-into-Pl.patch) at 2022-07-13 07:03:51 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v18-0002-Optimize-AcquireExecutorLocks-by-locking-only-un.patch) at 2022-07-13 06:40:10 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v17-0001-Move-PartitioPruneInfo-out-of-plan-nodes-into-Pl.patch) at 2022-07-06 02:37:57 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v16-0001-Move-PartitioPruneInfo-out-of-plan-nodes-into-Pl.patch) at 2022-05-27 08:09:46 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v15-0001-Optimize-AcquireExecutorLocks-to-skip-pruned-par.patch) at 2022-04-11 03:05:19 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v14-0001-Optimize-AcquireExecutorLocks-to-skip-pruned-par.patch) at 2022-04-08 11:45:37 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (misc_fixes.patch.txt) at 2022-04-08 11:15:53 from David Rowley <dgrowleyml at gmail.com> (Patch: Yes)
    Attachment (v13-0001-Optimize-AcquireExecutorLocks-to-skip-pruned-par.patch) at 2022-04-08 05:49:39 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v12-0001-Optimize-AcquireExecutorLocks-to-skip-pruned-par.patch) at 2022-04-07 08:27:50 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v11-0001-Optimize-AcquireExecutorLocks-to-skip-pruned-par.patch) at 2022-04-06 07:20:46 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v10-0001-Some-refactoring-of-runtime-pruning-code.patch) at 2022-04-05 02:29:49 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v9-0001-Some-refactoring-of-runtime-pruning-code.patch) at 2022-04-04 12:55:54 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v8-0004-Optimize-AcquireExecutorLocks-to-skip-pruned-part.patch) at 2022-03-31 03:25:20 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v7-0002-Add-Merge-Append.partitioned_rels.patch) at 2022-03-28 07:28:46 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v6-0003-Add-a-plan_tree_walker.patch) at 2022-03-28 07:17:00 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v5-0002-Add-a-plan_tree_walker.patch) at 2022-03-11 14:35:37 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v4-0001-Invent-a-new-executor-prep-phase.patch) at 2022-02-10 08:13:52 from Amit Langote <amitlangote09 at gmail.com> (Patch: No)
    Attachment (v3-0001-Teach-AcquireExecutorLocks-to-acquire-fewer-locks.patch) at 2022-01-18 01:32:57 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v2-0001-Teach-AcquireExecutorLocks-to-acquire-fewer-locks.patch) at 2022-01-14 14:10:43 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
    Attachment (v1-0001-Teach-AcquireExecutorLocks-to-acquire-fewer-locks.patch) at 2021-12-25 03:36:00 from Amit Langote <amitlangote09 at gmail.com> (Patch: Yes)
History
When Who What
2026-04-06 09:54:10 Amit Langote (amitlan) Attached mail thread CA+HiwqFGkMSge6TgC9KQzde0ohpAycLQuV7ooitEEpbKB0O_mg@mail.gmail.com
2026-04-06 09:53:54 Amit Langote (amitlan) Detached mail thread CA+HiwqFGkMSge6TgC9KQzde0ohpAycLQuV7ooitEEpbKB0O_mg@mail.gmail.com
2026-04-06 09:47:43 Amit Langote (amitlan) Moved from CF PG19-4 to CF PG20-1
2025-11-12 14:22:29 Amit Langote (amitlan) Attached mail thread CA+HiwqFGkMSge6TgC9KQzde0ohpAycLQuV7ooitEEpbKB0O_mg@mail.gmail.com
2025-11-12 14:22:29 Amit Langote (amitlan) Created patch record
Edit