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

From Scara Maccai
Subject Re: Nested Loop Left Join always shows rows=1
Date
Msg-id 492F7DD2.70806@yahoo.it
Whole thread Raw
In response to Re: Nested Loop Left Join always shows rows=1  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Tom Lane wrote:
> Scara Maccai <m_lists@yahoo.it> writes:
>>           ->  Index Scan using id_idx on tab1  (cost=0.00..8.27 rows=1
>> width=4) (actual time=0.010..0.011 rows=1 loops=1)
>>                 Index Cond: (id = 10)
>>           ->  Index Scan using out_id_idx on tab_outer  (cost=0.00..8.83
>> rows=1 width=8) (actual time=8.590..11.924 rows=2953 loops=1)
>>                 Index Cond: ((tab_outer.out_id = 10) AND (tab1.id =
>> tab_outer.out_id))
>
> This seems a bit broken :-( ... ideally it shouldn't be generating the
> redundant index condition, either.

Why is the index condition redundant? I guess the redundant part is

"AND (tab1.id = tab_outer.out_id)" but I'm not sure, and I would really appreciate if you could explain a little bit
more...

The reason I'm asking is because I'm looking at the implementation of some VERY basic form of progress indicator based
on"estimated rows vs rows already processed". 
I guess this would work for our DB because the planner is usually very good at guessing the number of rows for each
stepof the plan, since our distributions are pretty simple. 

But this left outer join thing I'm afraid would invalidate the method, since the inner table row count is always off...



Thank you for the reply.

(I added hackers too, since this seems a place where some
fixing/development would be necessary. I hope it's ok.)




pgsql-general by date:

Previous
From: Abdul Rahman
Date:
Subject: Re: [ADMIN] PgAgent Job Scehduler is NOT running
Next
From: Abdul Rahman
Date:
Subject: Re: [ADMIN] PgAgent Job Scehduler is NOT running