Re: Problem with left join when moving a column to another table

From: David Johnston <polobo(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Problem with left join when moving a column to another table
Date: 2013-06-21 04:28:26
Message-ID: 1371788906658-5760255.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sameer Thakur 2013-06-21 05:44:28 Re: Archiving and recovering pg_stat_tmp
Previous Message Jason Long 2013-06-21 03:16:32 Re: Problem with left join when moving a column to another table