Re: Parameterized append subpaths

Поиск
Список
Период
Сортировка
Искать

Re: Parameterized append subpaths

От:
Gleb Kashkin <g.kashkin@postgrespro.ru>
Дата:
Вложения:
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

Re: Parameterized append subpaths

От:
Etsuro Fujita <etsuro.fujita@gmail.com>
Дата:
Hi Gleb,

On Wed, Sep 23, 2026 at 6:12 PM Gleb Kashkin  wrote:
> 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.

+1

I proposed this FDW API a long time ago as part of the
foreign-table-inheritance work [1][2].  Have you looked at it?

Best regards,
Etsuro Fujita

[1] https://www.postgresql.org/message-id/530C7464.6020006%40lab.ntt.co.jp
[2] https://www.postgresql.org/message-id/532AE62A.6020307%40lab.ntt.co.jp


FAQ