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

From Tom Lane
Subject Re: BUG #16993: Query Planner does not use index for EXISTS-query on a large table with all equal foreign key values
Date
Msg-id 4016383.1620225070@sss.pgh.pa.us
Whole thread Raw
In response to BUG #16993: Query Planner does not use index for EXISTS-query on a large table with all equal foreign key values  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
PG Bug reporting form <noreply@postgresql.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



pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #16993: Query Planner does not use index for EXISTS-query on a large table with all equal foreign key values
Next
From: Alvaro Herrera
Date:
Subject: Re: ALTER CONSTRAINT on a partitioned FK isn't working