Partitionwise aggregate and runtime partition pruning

From: Michał Kłeczek <michal(at)kleczek(dot)org>
To: PG-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Partitionwise aggregate and runtime partition pruning
Date: 2024-09-26 07:58:18
Message-ID: F54D9FEE-0A39-490A-801F-B2858B527D01@kleczek.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi All,

I have a question about partition pruning.

Does runtime partition pruning (ie. pruning performed during execution) work with partition wise aggregates?

1) I have a setup with a mix of foreign (postgres_fdw) and local partitions.
2) I want to perform an aggregate query and I want the aggregates to be pushed down to remote servers.

To make it possible I set enable_partitionwise_aggregate to on.

My observation is that partition pruning works during planning time
But with plan_cache_mode = force_generic_plan, explain analyse execute prepared_stmt(params) shows that
_all_ partitions are scanned (and queries sent to remote severs for all remote partitions).

When I set enable_hashagg to false runtime partition pruning works but no pushdown is taking place.

Am I missing something or runtime partition pruning is not going to work for generic plans and partitionwise aggregates?

Thanks,
Michal

Browse pgsql-general by date

  From Date Subject
Next Message yudhi s 2024-09-26 11:03:28 Suggestion for memory parameters
Previous Message Muhammad Usman Khan 2024-09-26 03:34:27 Re: MError after replication in postgresql