"Aleksandr Vinokurov" <[EMAIL PROTECTED]> writes: > And that is its plan (attached one is the same, but with costs): > >>---------------------------------<cut>--------------------------------< > Merge Left Join > Merge Cond: ("outer".name = "inner".name) > -> Sort > Sort Key: log.name > -> Seq Scan on log_example_3 log > -> Sort > Sort Key: uh.name > -> Subquery Scan uh > -> Sort > Sort Key: name > -> Seq Scan on user_history >>---------------------------------<cut>--------------------------------<
What version are you running with? Incidentally with CVS HEAD I see it working: postgres=# explain select * from (select * from a order by i) as a right join b on a.i = b.i ; QUERY PLAN ----------------------------------------------------------------- Merge Right Join (cost=299.56..675.13 rows=22898 width=16) Merge Cond: (public.a.i = b.i) -> Sort (cost=149.78..155.13 rows=2140 width=8) Sort Key: public.a.i -> Seq Scan on a (cost=0.00..31.40 rows=2140 width=8) -> Sort (cost=149.78..155.13 rows=2140 width=8) Sort Key: b.i -> Seq Scan on b (cost=0.00..31.40 rows=2140 width=8) (8 rows) > With best regards to all of you, > Aleksandr. > ÿþ M e r g e L e f t J o i n > ( c o s t = 2 0 7 6 4 6 . 0 0 . . 2 1 3 8 6 4 . 1 2 r o w s = 3 4 7 8 5 1 > w i d t h = 6 2 ) ( a c t u a l > t i m e = 3 0 9 2 2 . 3 6 6 . . 3 2 1 6 6 . 5 1 8 r o w s = 1 3 9 0 8 > l o o p s = 1 ) > M e r g e C o n d : ( "