pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: T. Alex Beamish <talexb@tabsoft.on.ca>
Cc: Postgresql-Performance <pgsql-performance@postgresql.org>
Subject: Re: INNER JOIN vs WHERE
Date: Wed, 14 May 2003 22:25:55 -0400
Message-ID: <4921.1052965555@sss.pgh.pa.us> (raw)
In-Reply-To: <20030515014648.NRXV26559.tomts19-srv.bellnexxia.net@p433>
References: <20030515014648.NRXV26559.tomts19-srv.bellnexxia.net@p433>

"T. Alex Beamish" <talexb@tabsoft.on.ca> writes:
> Is there any rule of thumb about how much more efficient an INNER JOIN
> is compare to a regular WHERE statement?

Ideally there is no difference.  If there are only two tables involved,
there definitely is no difference.

If there is a difference, it's because there are more than two tables,
and the JOIN syntax forced a particular join order.  Read 
http://www.postgresql.org/docs/view.php?version=7.3&idoc=0&file=explicit-joins.html

Typically I'd expect JOIN syntax to be a loss because the odds are good
that you're forcing an inefficient join order.  It could be a win only
if the planner chooses a poor join order when given a free hand, or if
you have so many tables that you need to suppress the planner's search
for a good join order.

> I have not tried to do an EXPLAIN ANALYZE yet but I will try that.

If you have not bothered to do any EXPLAINs yet then you are really
wasting people's time on this list.

			regards, tom lane



view thread (2+ messages)

Message-ID: <4921.1052965555@sss.pgh.pa.us>
Permalink:  ../4921.1052965555@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/4921.1052965555@sss.pgh.pa.us

 · 

reply

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: tgl@sss.pgh.pa.us, talexb@tabsoft.on.ca
  Subject: Re: INNER JOIN vs WHERE
  In-Reply-To: <4921.1052965555@sss.pgh.pa.us>
  References: <20030515014648.NRXV26559.tomts19-srv.bellnexxia.net@p433> <4921.1052965555@sss.pgh.pa.us>

* 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