Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id D0A2B9FB366 for ; Wed, 20 Jun 2007 19:37:03 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 55814-01 for ; Wed, 20 Jun 2007 19:36:50 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id F22C29FB25D for ; Wed, 20 Jun 2007 19:36:52 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id l5KMafO4003619; Wed, 20 Jun 2007 18:36:41 -0400 (EDT) To: "Fernando Hevia" cc: "'PostgreSQL SQL List'" Subject: Re: Constraint exclusion In-reply-to: <03c801c7b387$2ad9eb70$8f01010a@iptel.com.ar> References: <03c801c7b387$2ad9eb70$8f01010a@iptel.com.ar> Comments: In-reply-to "Fernando Hevia" message dated "Wed, 20 Jun 2007 19:05:51 -0300" Date: Wed, 20 Jun 2007 18:36:41 -0400 Message-ID: <3618.1182379001@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/150 X-Sequence-Number: 28640 "Fernando Hevia" 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