Issue for partitioning with extra check constriants

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Issue for partitioning with extra check constriants
Date: 2010-10-01 23:46:31
Message-ID: 4CA672D7.3070405@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2010-10-01 23:56:17 Re: Issue for partitioning with extra check constriants
Previous Message Willy-Bas Loos 2010-10-01 17:51:26 Re: turn off caching for performance test