Thread: Partitionwise aggregate and runtime partition pruning

Partitionwise aggregate and runtime partition pruning

From
Michał Kłeczek
Date:
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