From: Tom Lane <tgl@sss.pgh.pa.us>
To: Fernando Hevia <fhevia@ip-tel.com.ar>
Cc: 'PostgreSQL SQL List' <pgsql-sql@postgresql.org>
Subject: Re: Constraint exclusion
Date: Wed, 20 Jun 2007 18:36:41 -0400
Message-ID: <3618.1182379001@sss.pgh.pa.us> (raw)
In-Reply-To: <03c801c7b387$2ad9eb70$8f01010a@iptel.com.ar>
References: <03c801c7b387$2ad9eb70$8f01010a@iptel.com.ar>
"Fernando Hevia" <fhevia@ip-tel.com.ar> writes:
> -- Constraints: one partition per month
> ALTER TABLE table_p01 ADD CONSTRAINT chk_table_p01_setuptime CHECK
> (EXTRACT(MONTH FROM setuptime) = 1::DOUBLE PRECISION);
The planner is not able to do anything with these constraints, other
than if there is an exact match to them in the query WHERE, which
there is not. Try simple range constraints on the column, instead.
The system does know about inferences like "colx <= const1 must
imply colx <= const2 if const1 <= const2". It does not know how
to reason about extract().
regards, tom lane
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-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, fhevia@ip-tel.com.ar
Subject: Re: Constraint exclusion
In-Reply-To: <3618.1182379001@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