Re: Incomprehensible dogged sort in Merge Join

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Aleksandr Vinokurov" <aleksandr(dot)vin(at)gmail(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Incomprehensible dogged sort in Merge Join
Date: 2007-08-31 14:45:37
Message-ID: 877inb225q.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Aleksandr Vinokurov" <aleksandr(dot)vin(at)gmail(dot)com> 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.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Aleksandr Vinokurov 2007-08-31 14:53:58 Re: Incomprehensible dogged sort in Merge Join
Previous Message Tom Lane 2007-08-31 14:43:39 Re: Incomprehensible dogged sort in Merge Join