Search Postgresql Archives

Re: subqueries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tomasz Grobelny <tomasz@xxxxxxxxxxxxxxxxxxxxxxx> 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

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux