Search Postgresql Archives

Re: subselects vs WITH in views

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

 



On Thu, Feb 21, 2013 at 4:31 AM, Seref Arikan <serefarikan@xxxxxxxxx> wrote:
> Hi Merlin,
> So should I interpret this as: there is a potential gain from choosing
> subqueries over with WITHs ?

Well, potentially, yes.  WITH is a mechanic to force iterative order
of evaluation on queries.  This can be a good or bad thing naturally.
Subqueries can also do this, especially if you put them in the field
select list -- but WITH is more general.  We also have an undocumented
hack that uses OFFSET 0 to force subquery evaluation.  These are all
very dangerous tools because they tend to be very sensitive to data
inputs as you are bypassing database statistics effectively.  The
other end of the spectrum is to use vanilla JOINs as much as possible
-- this releases the work of planning the query to the database.

Upcoming 9.3 LATERAL will remove one large class of cases where we
have to do this: joining against set returning functions with
non-constant inputs.

merlin


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[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