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

Поиск
Список
Период
Сортировка
От Yaroslav
Тема Re: BUG #14107: Major query planner bug regarding subqueries and indices
Дата
Msg-id 1461406942121-5900147.post@n5.nabble.com
обсуждение исходный текст
Ответ на Re: BUG #14107: Major query planner bug regarding subqueries and indices  (Mathias Kunter <mathiaskunter@gmail.com>)
Ответы Re: Re: BUG #14107: Major query planner bug regarding subqueries and indices  (Mathias Kunter <mathiaskunter@gmail.com>)
Список 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 по дате отправления:

Предыдущее
От: Kevin Burke
Дата:
Сообщение: Re: UPDATE grabs multiple rows when it seems like it should only grab one
Следующее
От: Mathias Kunter
Дата:
Сообщение: Re: Re: BUG #14107: Major query planner bug regarding subqueries and indices