Re: subqueries

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tomasz Grobelny <tomasz(at)grobelny(dot)oswiecenia(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: subqueries
Date: 2005-06-19 23:46:06
Message-ID: 7183.1119224766@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tomasz Grobelny <tomasz(at)grobelny(dot)oswiecenia(dot)net> writes:
> I have such a statement:
> select * from (subquery1) as foo, (subquery2) as bar;
> Both subqueries are reasonably fast (<0.5s) and generate results that have
> several (<10) rows but the whole query takes forever to execute.

The above is an unconstrained join: you are asking for the cross product
of the two subqueries. It seems unlikely that that is what you really
want. Perhaps you meant "subquery1 UNION ALL subquery2"?

regards, tom lane

In response to

  • subqueries at 2005-06-19 22:12:40 from Tomasz Grobelny

Browse pgsql-general by date

  From Date Subject
Next Message Grant Morgan 2005-06-20 00:54:33 unicode and =
Previous Message Andres 2005-06-19 23:32:51 Insert behavior in transaction