Re: Constraint exclusion

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Fernando Hevia" <fhevia(at)ip-tel(dot)com(dot)ar>
Cc: "'PostgreSQL SQL List'" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Constraint exclusion
Date: 2007-06-20 22:36:41
Message-ID: 3618.1182379001@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda pgsql-sql

"Fernando Hevia" <fhevia(at)ip-tel(dot)com(dot)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

In response to

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Alvaro Herrera 2007-06-20 22:51:11 Re: Lentitud de postgres
Previous Message Gabriel Hermes Colina Zambra 2007-06-20 22:31:27 Re: Ejecutar \copy desde VB

Browse pgsql-sql by date

  From Date Subject
Next Message Gabriel Hermes Colina Zambra 2007-06-20 23:14:26 Re: Ejecutar \copy desde VB
Previous Message Gabriel Hermes Colina Zambra 2007-06-20 22:31:27 Re: Ejecutar \copy desde VB