=?GBK?B?s8LR47fJ?= <postgresql_2016(at)163(dot)com> writes:
> postgres=# explain select * from test t1 left join test t2 on t1.b = t2.b and t2.c = 10 where t1.a = 1;
> QUERY PLAN
> -----------------------------------------------------------------------------
> Nested Loop Left Join (cost=0.85..48.16 rows=7418 width=24)
> -> Index Scan using a_idx on test t1 (cost=0.43..8.45 rows=1 width=12)
> Index Cond: (a = 1)
> -> Index Scan using b_idx on test t2 (cost=0.43..39.64 rows=7 width=12)
> Index Cond: (b = t1.b)
> Filter: (c = 10)
> (6 rows)
I tried to reproduce this and could not. What PG version are you
running exactly? Can you provide a self-contained example?
regards, tom lane