Re: On partitioning - Mailing list pgsql-hackers

From Amit Langote
Subject Re: On partitioning
Date
Msg-id 5490DF71.6060800@lab.ntt.co.jp
Whole thread Raw
In response to Re: On partitioning  (Claudio Freire <klaussfreire@gmail.com>)
List pgsql-hackers
On 17-12-2014 AM 12:28, Claudio Freire wrote:
> On Tue, Dec 16, 2014 at 12:15 PM, Robert Haas <robertmhaas@gmail.com> wrote:
>> I'm not really sure what you are getting here.  An "otherwise-good
>> expression" basically means a constant.  Index expressions have to be
>> things that always produce the same result given the same input,
>> because otherwise you might get a different result when searching the
>> index than you did when building it, and then you would fail to find
>> keys that are actually present.
> 
> I think the point is partitioning based on the result of an expression
> over row columns. 

Actually, in this case, I was thinking about a partition definition not
partition key definition. That is, using an expression as partition
value which has problems that I see.

> Or if it's not, it should be made anyway:
> 
> PARTITION BY LIST (extract(month from date_created) VALUES (1, 3, 6, 9, 12);
> 
> Or something like that.
> 

Such a thing seems very desirable though there are some tradeoffs
compared to having partitioning key be just attrnums. Or at least we can
start with that.

An arbitrary expression as partitioning key means that we have to
recompute such an expression for each input row. Think how inefficient
that may be when bulk-loading into a partitioned table during, say, a
COPY. Though there may be ways to fix that.

Thanks,
Amit




pgsql-hackers by date:

Previous
From: Amit Langote
Date:
Subject: Re: On partitioning
Next
From: Robert Haas
Date:
Subject: Re: On partitioning