Partitionwise aggregate and runtime partition pruning

2024-09-26 Thread Michał Kłeczek
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

Re: Runtime partition pruning

2020-03-23 Thread Radu Radutiu
Thanks. Yes, the query with the same parameter seems to work as expected. It doesn't help us though as we are trying to transparently support partitioning using an ORM and we cannot change the parameters. Using the column name would have been much easier. Regards, Radu On Mon, Mar 23, 2020 at 5:5

Re: Runtime partition pruning

2020-03-23 Thread Michael Lewis
> > select * from test where id between client_id-10 and client_id+10 and > client_id=?; > > does not (it scans all partitions in parallel) . > Is it expected? > Yes. But the below would work fine I expect since the planner would know a constant range for id. I would be very surprised if the opti

Runtime partition pruning

2020-03-23 Thread Radu Radutiu
Hello list, Is runtime partition pruning available in PostgreSQL 12? I have a table partitioned by range on column id (primary key). For the query (client_id is passed as a parameter from the application): select * from test where id between>0 and and id<1000 and client_id=? ; par

Runtime partition pruning with hash partitioning

2020-02-19 Thread Pavel Luzanov
Hello, Runtime partition pruning don't work without index on a hash partitioned column. Consider this test case on version 12: create table data (   key_id    integer not null,   value real not null ) partition by hash(key_id); create table data_0 partition of data for values

Re: How to make runtime partition pruning work?

2019-10-15 Thread Markus Heiden
Notice that only subqueries and parameterized nested loop joins are mentioned. The above text does not really go into the detail of which types of subqueries can be used, but I can confirm that they must be subqueries that can only return a scalar value. e.g WHERE x = (SELECT y FROM ...). The

Re: How to make runtime partition pruning work?

2019-10-14 Thread David Rowley
s too long, because PostgreSQL uses a hash join over all > partitions of "data_table" with the "import_table", instead of pruning > the "data_table" partitions by the import_ids at runtime. > Static pruning (when using ... IN (1, 2, 3, 4)) works fine though. &g

How to make runtime partition pruning work?

2019-10-11 Thread Markus Heiden
"import_table", instead of pruning the "data_table" partitions by the import_ids at runtime. Static pruning (when using ... IN (1, 2, 3, 4)) works fine though. What am I doing wrong that runtime partition pruning with PostgreSQL 11.5 does not work in my case? Thanks, Markus