Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 6EA059FA2CB for ; Sun, 3 Dec 2006 18:37:43 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 56084-08 for ; Sun, 3 Dec 2006 18:37:35 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.187]) by postgresql.org (Postfix) with ESMTP id 1D0909FA2A6 for ; Sun, 3 Dec 2006 18:37:38 -0400 (AST) Received: by nf-out-0910.google.com with SMTP id x4so4317670nfb for ; Sun, 03 Dec 2006 14:37:37 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=PIZ93vzy7rMb1/h/WvzrATIdVxxO23V1z8XCtJ72LXV1ryOYbMI8llT5/2vnhpUqktWC6ErRrLKlmLBr/l857lYoqGwiye9u4mHFWvtHBTg1sPLI5p5UU6jFySiaInr1OrBh8QhHLcx3R1PovPG6F+jwk1r1XduewsaKpeFieHI= Received: by 10.82.98.13 with SMTP id v13mr1367106bub.1165185457573; Sun, 03 Dec 2006 14:37:37 -0800 (PST) Received: by 10.82.164.12 with HTTP; Sun, 3 Dec 2006 14:37:37 -0800 (PST) Message-ID: <38443e510612031437h30337dejc928f059fb5fa79c@mail.gmail.com> Date: Mon, 4 Dec 2006 03:37:37 +0500 From: "Fayza Sultan" To: "Tom Lane" Subject: Re: Enabling constraint_exclusion does not avoid scanning all child partitions Cc: pgsql-performance@postgresql.org In-Reply-To: <24770.1165184727@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_23537_1419249.1165185457544" References: <38443e510612031421y3d8f8f05x8befb7adc166717d@mail.gmail.com> <24770.1165184727@sss.pgh.pa.us> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/37 X-Sequence-Number: 22093 ------=_Part_23537_1419249.1165185457544 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Your point solved my problem. Thank you -Fayza On 12/4/06, Tom Lane wrote: > > "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 > ------=_Part_23537_1419249.1165185457544 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
Your point solved my problem.
 
Thank you
 
-Fayza

 
On 12/4/06, Tom Lane <tgl@sss.pgh.pa.us> wrote:
"Fayza Sultan" <fayza.sultan@gmail.com> 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

------=_Part_23537_1419249.1165185457544--