Skip site navigation (1) Skip section navigation (2)

Re: performance - self-joins vs. subqueries

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "K(dot) Ari Krupnikov" <ari(at)iln(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: performance - self-joins vs. subqueries
Date: 2001-02-13 15:48:22
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
"K. Ari Krupnikov" <ari(at)iln(dot)net> writes:
> Tom Lane wrote:
>> "K. Ari Krupnikov" <ari(at)iln(dot)net> writes:
> Many queries can be formulated as either a self-join or a subquery on
> the same table.
> Is there any difference in performance, or does the analyzer treat them
> the same?
>> You're a lot better off with a self-join, at present.

> At present - is there a change planned?

Currently, EXISTS and IN sub-queries are always done by nested loops.
Sooner or later we will try to convert them into self-joins
automatically, so that smarter join methods can be used.  But for now
you need to write them as joins to begin with, if you want 'em to be

			regards, tom lane

In response to

pgsql-general by date

Next:From: Fred YankowskiDate: 2001-02-13 15:49:07
Previous:From: Anand RamanDate: 2001-02-13 15:44:49
Subject: Re: [ locking problem with JDBC (suspicion)]

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group