Proposal: partition pruning by secondary attributes - Mailing list pgsql-hackers

From Ildar Musin
Subject Proposal: partition pruning by secondary attributes
Date
Msg-id 5fd17d8a-d64e-e5b2-3fd8-a99062974486@postgrespro.ru
Whole thread Raw
Responses Re: Proposal: partition pruning by secondary attributes  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Re: Proposal: partition pruning by secondary attributes  (Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>)
List pgsql-hackers
Hello, hackers!

Sorry if this have already been discussed. I've had this idea some time
ago and then successfully forgot about it until pgconf.ru, where I had a
conversation with one of postgres users. His situation could be
described as this: they have a table with id, timestamp and some other
attributes, which is partitioned by (let's say) timestamp column. In
different contexts they may want to filter the table either by id or by
timestamp attribute (but not both). In this case pruning will only work
for timestamp column.

The idea is to store min and max values of secondary attributes (like
'id' in the example above) for each partition somewhere in catalog and
use it for partition pruning along with partitioning key. You can think
of it as somewhat like BRIN index but for partitions. And it will have
similar limitations. For example, we may benefit if secondary attribute
values are monotonically increase or decrease, but would be unhelpful if
they are scattered, or if table wasn't partitioned by range.

I wanted to ask community's opinion would it be worth considering.
Thanks!

-- 
Ildar Musin
i.musin@postgrespro.ru


pgsql-hackers by date:

Previous
From: Etsuro Fujita
Date:
Subject: Re: non-bulk inserts and tuple routing
Next
From: Amit Kapila
Date:
Subject: Re: In logical replication concurrent update of partition key createsa duplicate record on standby.