Re: Constraint exclusion - Mailing list pgsql-sql

From Fernando Hevia
Subject Re: Constraint exclusion
Date
Msg-id 041a01c7b44f$a0a459d0$8f01010a@iptel.com.ar
Whole thread Raw
In response to Re: Constraint exclusion  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
I see. Thanks for the tip.

Regards,
Fernando.

-----Mensaje original-----
De: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Enviado el: Miércoles, 20 de Junio de 2007 19:37
Para: Fernando Hevia
CC: 'PostgreSQL SQL List'
Asunto: Re: [SQL] Constraint exclusion

"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



pgsql-sql by date:

Previous
From: Ragnar
Date:
Subject: Re: join problem
Next
From: "Bart Degryse"
Date:
Subject: Transactions and Exceptions