From: lars hofhansl <lhofhansl@yahoo.com>
To: Adarsh Sharma <adarsh.sharma@orkash.com>
To: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: Which Join is better
Date: Tue, 2 Aug 2011 17:16:26 -0700 (PDT)
Message-ID: <1312330586.28870.YahooMailNeo@web121710.mail.ne1.yahoo.com> (raw)
In-Reply-To: <4E379C43.7020805@orkash.com>
References: <4E379C43.7020805@orkash.com>
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.sharma@orkash.com>
To: pgsql-performance@postgresql.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@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-performance@postgresql.org
Cc: lhofhansl@yahoo.com, adarsh.sharma@orkash.com
Subject: Re: Which Join is better
In-Reply-To: <1312330586.28870.YahooMailNeo@web121710.mail.ne1.yahoo.com>
References: <4E379C43.7020805@orkash.com> <1312330586.28870.YahooMailNeo@web121710.mail.ne1.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox