Search Postgresql Archives

How to make runtime partition pruning work?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I partitioned a table "data_table" by the key "import_id" to reduce the number of partitions to be loaded in my queries. I used list partitions, each containing usually just one "import_id". I used a primary key (id, import_id) But PostgreSQL does not consider partition keys to avoid loading not needed partitions.

My query:
SELECT SUM(something) FROM data_table WHERE import_id IN (SELECT id FROM import_table WHERE ...)
My problem:
The query takes 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.

What am I doing wrong that runtime partition pruning with PostgreSQL 11.5 does not work in my case?

Thanks,
Markus






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux