pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: dmitry potapov <potapov.dmitry@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: "WHERE 1 = 2 OR ..." makes planner choose a very inefficient plan
Date: Thu, 18 Apr 2013 15:43:20 +0100
Message-ID: <51700688.4050505@archonet.com> (raw)
In-Reply-To: <CAJPZb_vmf3dkCv0Rre+VOm6bkJc3hugjEE2h0bgY1WqduDLUbg@mail.gmail.com>
References: <CAJPZb_vmf3dkCv0Rre+VOm6bkJc3hugjEE2h0bgY1WqduDLUbg@mail.gmail.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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


-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



view thread (5+ messages)  latest in thread

Message-ID: <51700688.4050505@archonet.com>
Permalink:  ../51700688.4050505@archonet.com/
Also on:    postgresql.org/message-id/51700688.4050505@archonet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: dev@archonet.com, potapov.dmitry@gmail.com
  Subject: Re: "WHERE 1 = 2 OR ..." makes planner choose a very inefficient plan
  In-Reply-To: <51700688.4050505@archonet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox