X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3C743329E70 for ; Sun, 3 Oct 2004 00:21:24 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 05712-01 for ; Sat, 2 Oct 2004 23:21:16 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 64ECC329E55 for ; Sun, 3 Oct 2004 00:21:18 +0100 (BST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id i92NLHvq026955; Sat, 2 Oct 2004 19:21:17 -0400 (EDT) To: Ryan VanMiddlesworth Cc: pgsql-performance@postgresql.org Subject: Re: Query planner problem In-reply-to: <200410011706.54231.ryan@vanmiddlesworth.org> References: <200410011706.54231.ryan@vanmiddlesworth.org> Comments: In-reply-to Ryan VanMiddlesworth message dated "Fri, 01 Oct 2004 17:06:54 -0500" Date: Sat, 02 Oct 2004 19:21:16 -0400 Message-ID: <26954.1096759276@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/21 X-Sequence-Number: 8497 Ryan VanMiddlesworth writes: > And here is the query and EXPLAIN from the version that I believe the planner > should reduce to be logically equivalent: > SELECT case_id FROM case_data > WHERE (('2004-09-16' IS NULL) OR (case_filed_date > '2004-09-16')) > AND (('2004-09-20' IS NULL) OR (case_filed_date < '2004-09-20')) > I was hoping that the null comparisons would get folded out by the planner > relatively cheaply. You could teach eval_const_expressions about simplifying NullTest nodes if you think it's important enough. regards, tom lane