pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Yaroslav <ladayaroslav@yandex.ru>
To: pgsql-bugs@postgresql.org
Subject: Re: BUG #14107: Major query planner bug regarding subqueries and indices
Date: Sat, 23 Apr 2016 03:22:22 -0700 (MST)
Message-ID: <1461406942121-5900147.post@n5.nabble.com> (raw)
In-Reply-To: <44df2e58-87f5-282c-9871-c735240c55e4@gmail.com>
References: <20160421115638.22895.78902@wrigleys.postgresql.org>
	<CAKJS1f_Hv+gBpg8JF0T8PEyW0TzVgydkcp2dPZHeomkDUGsRyA@mail.gmail.com>
	<69e376c7-6c2c-c96d-2ad6-3734affb59b7@gmail.com>
	<CAGnEboiCo+NuGab0PEnUQ2Nf0DXZv2Rvo2xWhMbi88n=guZB5w@mail.gmail.com>
	<CA+bJJbyUF6CZPgH45JUdRRJ96qHMd31Fb-qHw0iN2aohRYMM6g@mail.gmail.com>
	<CAGnEbogfdNPxN7vvY_8b4bPj4VVDzEw5NaXVBRSWUMQgKZE-CA@mail.gmail.com>
	<44df2e58-87f5-282c-9871-c735240c55e4@gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Hmm... and this is even worse (on the data you provided):

EXPLAIN (ANALYZE, BUFFERS)
SELECT *
  FROM book
 WHERE name = 'Harry Potter'
    OR EXISTS (
       SELECT 1 
         FROM author 
        WHERE author.id = book.author AND author.name = 'Rowling'
       );


Seq Scan on book  (cost=0.00..832685.00 rows=50000 width=41) (actual
time=35.848..35.848 rows=0 loops=1)
  Filter: (((name)::text = 'Harry Potter'::text) OR (alternatives: SubPlan 1
or hashed SubPlan 2))
  Rows Removed by Filter: 100000
  Buffers: shared hit=937
  SubPlan 1
    ->  Index Scan using author_name_index on author  (cost=0.29..8.30
rows=1 width=0) (never executed)
          Index Cond: ((name)::text = 'Rowling'::text)
          Filter: (id = book.author)
  SubPlan 2
    ->  Index Scan using author_name_index on author author_1 
(cost=0.29..8.30 rows=1 width=4) (actual time=0.027..0.027 rows=0 loops=1)
          Index Cond: ((name)::text = 'Rowling'::text)
          Buffers: shared hit=2
Planning time: 0.268 ms
Execution time: 35.923 ms



-----
WBR, Yaroslav Schekin.
--
View this message in context: http://postgresql.nabble.com/BUG-14107-Major-query-planner-bug-regarding-subqueries-and-indices-tp58...
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.


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



view thread (20+ messages)  latest in thread

Message-ID: <1461406942121-5900147.post@n5.nabble.com>
Permalink:  ../1461406942121-5900147.post@n5.nabble.com/
Also on:    postgresql.org/message-id/1461406942121-5900147.post@n5.nabble.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: ladayaroslav@yandex.ru
  Subject: Re: BUG #14107: Major query planner bug regarding subqueries and indices
  In-Reply-To: <1461406942121-5900147.post@n5.nabble.com>
  References: <20160421115638.22895.78902@wrigleys.postgresql.org> <CAKJS1f_Hv+gBpg8JF0T8PEyW0TzVgydkcp2dPZHeomkDUGsRyA@mail.gmail.com> <69e376c7-6c2c-c96d-2ad6-3734affb59b7@gmail.com> <CAGnEboiCo+NuGab0PEnUQ2Nf0DXZv2Rvo2xWhMbi88n=guZB5w@mail.gmail.com> <CA+bJJbyUF6CZPgH45JUdRRJ96qHMd31Fb-qHw0iN2aohRYMM6g@mail.gmail.com> <CAGnEbogfdNPxN7vvY_8b4bPj4VVDzEw5NaXVBRSWUMQgKZE-CA@mail.gmail.com> <44df2e58-87f5-282c-9871-c735240c55e4@gmail.com> <1461406942121-5900147.post@n5.nabble.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