Re: BUG #16993: Query Planner does not use index for EXISTS-query on a large table with all equal foreign key values

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: a(dot)schnabl(at)synedra(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16993: Query Planner does not use index for EXISTS-query on a large table with all equal foreign key values
Date: 2021-05-05 14:31:10
Message-ID: 4016383.1620225070@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> ... EXPLAIN ANALYZE shows the following query plan:

> Merge Join (cost=179053.41..179054.24 rows=1 width=8) (actual
> time=2140.820..2140.822 rows=1 loops=1)

> [ but with ] SET enable_seqscan = false:

> Nested Loop Semi Join (cost=0.57..12.85 rows=1 width=8) (actual
> time=0.877..0.920 rows=1 loops=1)

Yeah, that seems *extremely* broken. The planner correctly estimates
the second plan as much cheaper, so why did it fail to choose that one
without help? Will look into this.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2021-05-05 15:28:31 Re: BUG #16991: regclass is not case sensitive causing "relation does not exist" error
Previous Message PG Bug reporting form 2021-05-05 13:24:05 BUG #16993: Query Planner does not use index for EXISTS-query on a large table with all equal foreign key values