Hello,

According to the documentation, I thought it was possible to force given
join orders with parenthesis.

But in this small example, this seems to have no effect; 
With the first query, I'd expected to see t3 in the  Merge Right Join
but both queries return the same query plan .

I'm missing a point ?

(Postgres 8.3)

create temp table t1(i int);
create temp table t2(i int);
create temp table t3(i int);

select * from 
 ( 
   ( t1 LEFT OUTER JOIN  t2  on (t1.i=t2.i) )
   LEFT OUTER JOIN t3 on (t2.i=t3.i)
 )

select * from 
 ( 
   t1 LEFT OUTER JOIN  
   (t2 LEFT OUTER JOIN t3 on (t2.i=t3.i) )
   on (t1.i=t2.i) 
)

Merge Right Join  (cost=506.24..6206.24 rows=345600 width=12)
  Merge Cond: (t2.i = t1.i)
  ->  Merge Left Join  (cost=337.49..781.49 rows=28800 width=8)
        Merge Cond: (t2.i = t3.i)
        ->  Sort  (cost=168.75..174.75 rows=2400 width=4)
              Sort Key: t2.i
              ->  Seq Scan on t2  (cost=0.00..34.00 rows=2400 width=4)
        ->  Sort  (cost=168.75..174.75 rows=2400 width=4)
              Sort Key: t3.i
              ->  Seq Scan on t3  (cost=0.00..34.00 rows=2400 width=4)
  ->  Sort  (cost=168.75..174.75 rows=2400 width=4)
        Sort Key: t1.i
        ->  Seq Scan on t1  (cost=0.00..34.00 rows=2400 width=4)



best  regards,

Marc Mamin

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

Reply via email to