Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 4BC089FB75C for ; Thu, 21 Jun 2007 19:00:51 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 35861-05 for ; Thu, 21 Jun 2007 19:00:45 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from pyxis.powervt.com.ar (host3.powervt.com.ar [200.43.63.66]) by postgresql.org (Postfix) with ESMTP id 1B01A9FB34F for ; Thu, 21 Jun 2007 19:00:44 -0300 (ADT) Received: from pcfhevia ([201.216.249.98]) by pyxis.powervt.com.ar (IPGroup Mail Server) with ESMTP id 1OT48953; Thu, 21 Jun 2007 19:00:42 -0300 From: "Fernando Hevia" To: "'Tom Lane'" Cc: "'PostgreSQL SQL List'" Subject: Re: Constraint exclusion Date: Thu, 21 Jun 2007 19:00:45 -0300 Organization: IP-TEL Message-ID: <041a01c7b44f$a0a459d0$8f01010a@iptel.com.ar> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <3618.1182379001@sss.pgh.pa.us> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 Thread-Index: Acezi38+QXliSIteSXyFPTpcMOsWhQAw/AiQ X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/171 X-Sequence-Number: 28661 I see. Thanks for the tip. Regards, Fernando. -----Mensaje original----- De: Tom Lane [mailto:tgl@sss.pgh.pa.us]=20 Enviado el: Mi=E9rcoles, 20 de Junio de 2007 19:37 Para: Fernando Hevia CC: 'PostgreSQL SQL List' Asunto: Re: [SQL] Constraint exclusion=20 "Fernando Hevia" writes: > -- Constraints: one partition per month > ALTER TABLE table_p01 ADD CONSTRAINT chk_table_p01_setuptime CHECK > (EXTRACT(MONTH FROM setuptime) =3D 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 <=3D const1 must imply colx <=3D const2 if const1 <=3D const2". It does not know how to reason about extract(). regards, tom lane