Re: Query planner problem - Mailing list pgsql-performance

From Tom Lane
Subject Re: Query planner problem
Date
Msg-id 26954.1096759276@sss.pgh.pa.us
Whole thread Raw
In response to Query planner problem  (Ryan VanMiddlesworth <ryan@vanmiddlesworth.org>)
List pgsql-performance
Ryan VanMiddlesworth <ryan@vanmiddlesworth.org> 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

pgsql-performance by date:

Previous
From: Hannu Krosing
Date:
Subject: Re: inconsistent/weird index usage
Next
From: Tom Lane
Date:
Subject: Re: inconsistent/weird index usage