Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id E0DD09FA2CB for ; Sun, 3 Dec 2006 18:25:33 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 25332-04 for ; Sun, 3 Dec 2006 18:25:30 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id CC8389FA2A6 for ; Sun, 3 Dec 2006 18:25:29 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id kB3MPR66024771; Sun, 3 Dec 2006 17:25:27 -0500 (EST) To: "Fayza Sultan" cc: pgsql-performance@postgresql.org Subject: Re: Enabling constraint_exclusion does not avoid scanning all child partitions In-reply-to: <38443e510612031421y3d8f8f05x8befb7adc166717d@mail.gmail.com> References: <38443e510612031421y3d8f8f05x8befb7adc166717d@mail.gmail.com> Comments: In-reply-to "Fayza Sultan" message dated "Mon, 04 Dec 2006 03:21:51 +0500" Date: Sun, 03 Dec 2006 17:25:27 -0500 Message-ID: <24770.1165184727@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/36 X-Sequence-Number: 22092 "Fayza Sultan" writes: > CREATE TABLE parent ( > monthdate date NOT NULL, > id int4 NOT NULL, > CONSTRAINT parent_idx PRIMARY KEY (monthdate,id ) > ); > CREATE TABLE child1 > ( > CONSTRAINT child1_idx PRIMARY KEY (monthdate,id), > CONSTRAINT child1_chk CHECK (monthdate >= '2006-01-01 00:00:00'::timestamp > without time zone AND monthdate < '2006-02-01 00:00:00'::timestamp without > time zone) monthdate is date, not timestamp. See the caveat in the documentation about avoiding cross-type comparisons when formulating constraints for constraint exclusion to use. regards, tom lane