pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Fayza Sultan <fayza.sultan@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Enabling constraint_exclusion does not avoid scanning all child partitions
Date: Sun, 03 Dec 2006 17:25:27 -0500
Message-ID: <24770.1165184727@sss.pgh.pa.us> (raw)
In-Reply-To: <38443e510612031421y3d8f8f05x8befb7adc166717d@mail.gmail.com>
References: <38443e510612031421y3d8f8f05x8befb7adc166717d@mail.gmail.com>

"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



view thread (3+ messages)  latest in thread

Message-ID: <24770.1165184727@sss.pgh.pa.us>
Permalink:  ../24770.1165184727@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/24770.1165184727@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, fayza.sultan@gmail.com
  Subject: Re: Enabling constraint_exclusion does not avoid scanning all child partitions
  In-Reply-To: <24770.1165184727@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox