Re: [SQL] Sub-select speed. - Mailing list pgsql-sql

From Tom Lane
Subject Re: [SQL] Sub-select speed.
Date
Msg-id 11757.945473101@sss.pgh.pa.us
Whole thread Raw
In response to Re: [SQL] Sub-select speed.  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: [SQL] Sub-select speed.
List pgsql-sql
Bruce Momjian <pgman@candle.pha.pa.us> writes:
>> There has been some talk of automatically rewriting queries to eliminate
>> unnecessary sub-selects, but I don't foresee it getting done for a
>> while yet.

> Tom, you mentioned that subselects use nested join, but they could be
> hardcoded to use hash join.  My opinion is that this should be done if
> it is easy.

That would probably help for uncorrelated subselects (where no variable
from the outer query is referenced in the inner one).  For correlated
subselects, such as this one is, hashing the subselect result isn't
going to help much --- the real problem is that the subselect is
repeated afresh for each outer tuple.
        regards, tom lane


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: [SQL] avg() on numeric ?
Next
From: wieck@debis.com (Jan Wieck)
Date:
Subject: Re: [SQL] avg() on numeric ?