Re: BUG #14107: Major query planner bug regarding subqueries and indices - Mailing list pgsql-bugs

From Yaroslav
Subject Re: BUG #14107: Major query planner bug regarding subqueries and indices
Date
Msg-id 1461406942121-5900147.post@n5.nabble.com
Whole thread Raw
In response to Re: BUG #14107: Major query planner bug regarding subqueries and indices  (Mathias Kunter <mathiaskunter@gmail.com>)
Responses Re: Re: BUG #14107: Major query planner bug regarding subqueries and indices
List pgsql-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-tp5899873p5900147.html
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.

pgsql-bugs by date:

Previous
From: Kevin Burke
Date:
Subject: Re: UPDATE grabs multiple rows when it seems like it should only grab one
Next
From: Mathias Kunter
Date:
Subject: Re: Re: BUG #14107: Major query planner bug regarding subqueries and indices