[PATCH] Referenced generic plan mode

From: Vlada Pogozhelskaya <pogozhelskaya(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: [PATCH] Referenced generic plan mode
Date: 2025-09-04 13:08:05
Message-ID: 19919494-92a8-4905-a250-6cf17b89f7c3@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

I’d like to propose a patch that introduces a*referenced generic plan*mode.

The patch adds:

*

new EXPLAIN option|REF_GENERIC_PLAN|(not allowed with ANALYZE);

*

new|plan_cache_mode|values|ref_auto|and|force_ref_generic_plan|;

*

a flag to prevent constant folding of Params when building a generic
plan.

Generic and custom plan behavior stays unchanged unless the new option
is used.
Similar ideas exist in other systems: Oracle (Adaptive Cursor Sharing),
SQL Server (Parameter Sensitive Plan Optimization), and Db2 (REOPT).

I’ve attached the patch and a minimal regression test.

Best regards,
Vlada Pogozhelskaya

Attachment Content-Type Size
0001-Referenced-optimisation-of-Generic-plans.patch text/plain 12.4 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabrice Chapuis 2025-09-04 13:26:59 issue with synchronized_standby_slots
Previous Message Dean Rasheed 2025-09-04 12:50:41 Re: Inconsistent update in the MERGE command