Re: Enabling constraint_exclusion does not avoid scanning all child partitions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Fayza Sultan" <fayza(dot)sultan(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Enabling constraint_exclusion does not avoid scanning all child partitions
Date: 2006-12-03 22:25:27
Message-ID: 24770.1165184727@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

"Fayza Sultan" <fayza(dot)sultan(at)gmail(dot)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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Fayza Sultan 2006-12-03 22:37:37 Re: Enabling constraint_exclusion does not avoid scanning all child partitions
Previous Message Fayza Sultan 2006-12-03 22:21:51 Enabling constraint_exclusion does not avoid scanning all child partitions