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

From Victor Yegorov
Subject Re: BUG #14107: Major query planner bug regarding subqueries and indices
Date
Msg-id CAGnEboiCo+NuGab0PEnUQ2Nf0DXZv2Rvo2xWhMbi88n=guZB5w@mail.gmail.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: BUG #14107: Major query planner bug regarding subqueries and indices
List pgsql-bugs
2016-04-22 17:02 GMT+03:00 Mathias Kunter <mathiaskunter@gmail.com>:

> EXPLAIN SELECT * FROM book WHERE name = 'Harry Potter' OR authorId IN
> (SELECT id FROM author WHERE surname = 'Rowling');
>                                         QUERY PLAN
>
> -------------------------------------------------------------------------------------------
>  Seq Scan on book  (cost=13.68..26792.88 rows=576709 width=40)
> ...
>
> EXPLAIN SELECT * FROM book WHERE name = 'Harry Potter' UNION SELECT * FROM
> book WHERE authorId IN (SELECT id FROM author WHERE surname = 'Rowling');
>                                                  QUERY PLAN
>
> ------------------------------------------------------------------------------------------------------------
>  HashAggregate  (cost=454.87..455.99 rows=112 width=29)
>

Queries return different number of rows, meaning they're not fully
equivalent.
Can you provide full DDL for the tables, constraints and indexes in use?


--
Victor Y. Yegorov

pgsql-bugs by date:

Previous
From: Mathias Kunter
Date:
Subject: Re: BUG #14107: Major query planner bug regarding subqueries and indices
Next
From: Francisco Olarte
Date:
Subject: Re: BUG #14107: Major query planner bug regarding subqueries and indices