Re: Which Join is better

From: lars hofhansl <lhofhansl(at)yahoo(dot)com>
To: Adarsh Sharma <adarsh(dot)sharma(at)orkash(dot)com>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Which Join is better
Date: 2011-08-03 00:16:26
Message-ID: 1312330586.28870.YahooMailNeo@web121710.mail.ne1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Unless you use the explicit join syntax:

select p.* from A p join B q on (p.id = q.id)

and also set  join_collapse_limit= 1
The order of the joins is determined by the planner.

Also explain is your friend :)

________________________________
From: Adarsh Sharma <adarsh(dot)sharma(at)orkash(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Sent: Monday, August 1, 2011 11:42 PM
Subject: [PERFORM] Which Join is better

Dear all,

Just want to know which join is better for querying data faster.

I have 2 tables A ( 70 GB ) & B ( 7 MB )

A has 10 columns & B has 3 columns.Indexes exist on both tables's ids.

select p.* from table A p, B q where p.id=q.id

or

select p.* from table B q , A p where q.id=p.id

Thanks

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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Robert Klemme 2011-08-03 07:18:12 Re: Performance penalty when using WITH
Previous Message lars hofhansl 2011-08-03 00:08:08 Re: synchronous_commit off