Issue for partitioning with extra check constriants - Mailing list pgsql-performance

From Josh Berkus
Subject Issue for partitioning with extra check constriants
Date
Msg-id 4CA672D7.3070405@agliodbs.com
Whole thread Raw
Responses Re: Issue for partitioning with extra check constriants
List pgsql-performance
Simon, Greg, etc.,

Just barked my nose against a major performance issue with CE &
partitioning, and was wondering if anyone had poked at it.

The issue is this: when a partitioned table is evaluated by the planner
for constraint exclusion, it evaluates ALL check constraints on each
partition, regardless of whether or not they include a referenced column
in the query (and whether or not they relate to partitioning).  If some
of those check constraints are expensive (like GIS functions) then this
can add considerably (on the order of 2ms per partition) to planning time.

If this is news to anyone, I have a nice test case.

So ... how plausible is it to fix the planner so that it only evaluates
check constraints on a partition if there is a match of referenced
columns?  Are we talking "moderate", "hard" or "nearly impossible"?

--
                                  -- Josh Berkus
                                     PostgreSQL Experts Inc.
                                     http://www.pgexperts.com

pgsql-performance by date:

Previous
From: Willy-Bas Loos
Date:
Subject: Re: turn off caching for performance test
Next
From: Tom Lane
Date:
Subject: Re: Issue for partitioning with extra check constriants