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

From: Richard Huxton <dev(at)archonet(dot)com>
To: dmitry potapov <potapov(dot)dmitry(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: "WHERE 1 = 2 OR ..." makes planner choose a very inefficient plan
Date: 2013-04-18 14:43:20
Message-ID: 51700688.4050505@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2013-04-18 14:46:57 Re: "WHERE 1 = 2 OR ..." makes planner choose a very inefficient plan
Previous Message dmitry potapov 2013-04-18 14:20:48 "WHERE 1 = 2 OR ..." makes planner choose a very inefficient plan