Re: A Guide to Constraint Exclusion (Partitioning)

From: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Subject: Re: A Guide to Constraint Exclusion (Partitioning)
Date: 2005-07-24 13:44:24
Message-ID: 42E39B38.9000706@cheapcomplexdevices.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Simon Riggs wrote:
> in those cases you are really just maintaining the indexes for partitioning
> purposes. On older data it may be desirable not to have lots of indexes,
> or at least use their resources on the indexes they really do want.
>
> Also, if you have a List partitioned table where all rows in that table
> have a single value, then you maintain an index for no reason other than
> partitioning. Thats an expensive waste.
>
> Simply put, adding a constraint is faster and cheaper than adding an
> pointless index. CE gives people that option.

It seems with a partial index that whose partial index condition
specifies a range outside that of a partition would make the expense
much cheaper.

For example, if I created a couple partial indexes

ON sales_2005(year) WHERE year<2005
ON sales_2005(year) WHERE year>2005

I would think it would be a very cheap index to maintain
(they'd be very small because they're empty, I'd think)
and give many of the same benefits for excluding tables
as a non-partial index on year would have given.

Ron

I like the other features Simon mentioned, though, that sound like
they're based on these constraints.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-07-24 13:50:17 Re: interval->day patch and docs
Previous Message Andrew Dunstan 2005-07-24 13:40:42 Re: [HACKERS] Patch to fix plpython on OS X