Re: Parameterized append subpaths

From: Gleb Kashkin <g(dot)kashkin(at)postgrespro(dot)ru>
To: Alexander Pyhalov <a(dot)pyhalov(at)postgrespro(dot)ru>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Parameterized append subpaths
Date: 2026-09-23 09:11:56
Message-ID: 98f84e7438c5b78a5a1c77539ffc7e0b@postgrespro.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alexander Pyhalov писал(а) 2026-09-09 10:51:

> There's a (likely well known) add_path() issue - it can remove the
> path, which otherwise would be useful in the future

Hi!

We found another way to address the issue. It could be better suited for
current path selection model:
Instead of keeping all parameterized foreign paths, we could
re-parameterize the ones that were left after add_path() domination, as
is already done with other path types. This requires a new FDW interface
function, but allows to keep current path domination logic and build
additional foreign paths only when they are truly required, like in
parametrized NestLoop.

The first attached patch implements path reparameterization in
postgres_fwd and adds it to reparameterize_path().
The second patch is optional, it adds a cache for parameterized paths in
postgres_fdw, so there is no excessive roundtrip for remote estimate
EXPLAIN for paths that have already been costed and rejected.

--
Best regards,
Gleb Kashkin,
Postgres Professional

Attachment Content-Type Size
0001-Allow-FDWs-to-reparameterize-foreign-scan-paths.patch text/x-diff 16.8 KB
0002-postgres_fdw-cache-parameterized-path-cost-estimates.patch text/x-diff 6.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2026-09-23 09:30:54 Re: ORDER BY ALL
Previous Message Peter Eisentraut 2026-09-23 09:00:28 Re: Fix conversion warnings in headers