Re: Problem with left join when moving a column to another table - Mailing list pgsql-general

From David Johnston
Subject Re: Problem with left join when moving a column to another table
Date
Msg-id 1371788906658-5760255.post@n5.nabble.com
Whole thread Raw
In response to Re: Problem with left join when moving a column to another table  (Jason Long <mailing.lists@octgsoftware.com>)
List pgsql-general
Jason Long-2 wrote
> Does the syntax you showed me have performance benefits vs joining a
> bunch of views together?

As a general rule CTE/WITH is going to be worse performing than the
equivalent view definition - depending on the view is actually used in the
query of course.  They both have their place.  A CTE/WITH is basically a
per-query VIEW though there is an optimization barrier that doesn't allow
the main query WHERE clause to limit the queries like it a view would
normally allow if possible.  Because of this I'll occasionally find need to
specify redundant where clauses inside the CTE to get decent performance on
large tables - mostly for my interactive queries.

David J.




--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Problem-with-left-join-when-moving-a-column-to-another-table-tp5760187p5760255.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


pgsql-general by date:

Previous
From: Jason Long
Date:
Subject: Re: Problem with left join when moving a column to another table
Next
From: Sameer Thakur
Date:
Subject: Re: Archiving and recovering pg_stat_tmp