Re: BUG #14107: Major query planner bug regarding subqueries and indices

From: Victor Yegorov <vyegorov(at)gmail(dot)com>
To: Mathias Kunter <mathiaskunter(at)gmail(dot)com>
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14107: Major query planner bug regarding subqueries and indices
Date: 2016-04-22 14:14:12
Message-ID: CAGnEboiCo+NuGab0PEnUQ2Nf0DXZv2Rvo2xWhMbi88n=guZB5w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

2016-04-22 17:02 GMT+03:00 Mathias Kunter <mathiaskunter(at)gmail(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Armando Perryman Morales 2016-04-22 15:30:12 problem installing postgres in debian8 from debian repository
Previous Message Mathias Kunter 2016-04-22 14:08:54 Re: BUG #14107: Major query planner bug regarding subqueries and indices