Re: "WHERE 1 = 2 OR ..." makes planner choose a very inefficient plan

Richard Huxton <dev@archonet.com>

From: Richard Huxton <dev@archonet.com>
To: dmitry potapov <potapov.dmitry@gmail.com>
Cc: pgsql-performance@postgresql.org
Date: 2013-04-18T14:43:20Z
Lists: pgsql-performance
On 18/04/13 15:20, dmitry potapov wrote:
> Hello,
>
> I recently stumbled upon on what could be a planner bug or a corner
> case. If "<false condition> OR ..." is added to WHERE clause of SELECT
> query, then the planner chooses a very inefficient plan. Consider a query:

> If I comment out "1=2 OR", then the plan changes dramatically:

What happens if you substitute:
1. 1=3   OR
2. false OR

-- 
   Richard Huxton
   Archonet Ltd