Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 156C8133729E for ; Fri, 1 Oct 2010 20:46:43 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 40369-01 for ; Fri, 1 Oct 2010 23:46:37 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from glacier.frostconsultingllc.com (glacier.frostconsultingllc.com [69.36.227.170]) by mail.postgresql.org (Postfix) with ESMTP id DCBCB133655C for ; Fri, 1 Oct 2010 20:46:35 -0300 (ADT) Received: from dsl081-245-111.sfo1.dsl.speakeasy.net ([64.81.245.111] helo=Sidney-Stratton.local) by glacier.frostconsultingllc.com with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.69) (envelope-from ) id 1P1pJA-0004qg-H3 for pgsql-performance@postgresql.org; Fri, 01 Oct 2010 16:46:34 -0700 Message-ID: <4CA672D7.3070405@agliodbs.com> Date: Fri, 01 Oct 2010 16:46:31 -0700 From: Josh Berkus User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1b3pre) Gecko/20090223 Thunderbird/3.0b2 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Issue for partitioning with extra check constriants Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201010/13 X-Sequence-Number: 40432 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