Re: Nested Loop Left Join always shows rows=1 - Mailing list pgsql-general

From Tom Lane
Subject Re: Nested Loop Left Join always shows rows=1
Date
Msg-id 1135.1228165780@sss.pgh.pa.us
Whole thread Raw
In response to Nested Loop Left Join always shows rows=1  (Scara Maccai <m_lists@yahoo.it>)
List pgsql-general
Scara Maccai <m_lists@yahoo.it> writes:
> I ran ANALYZE on both tables, but the plan shows rows=1 in the inner
> table results.

> If I change the "left outer join" into an "inner join" the bitmap index
> scan of the inner table of the nested loop shows a correct number of
> rows (not the exact same thing as "actual rows", but very close).

Yeah, this is a bug: it's effectively double-counting the selectivity of
the index clause.  The error isn't enormously critical, since the join
size estimate is right; but it could perhaps lead to choosing a plain
indexscan when a bitmap scan would be better.  I've applied a patch.

            regards, tom lane

pgsql-general by date:

Previous
From: Maxim Boguk
Date:
Subject: Re: Indexes on NULL's and order by ... limit N queries
Next
From: Tom Lane
Date:
Subject: Re: Indexes on NULL's and order by ... limit N queries