Search Postgresql Archives

Re: Multiple SELECT statements Using One WITH statement

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

 



On Thu, Jan 20, 2022 at 4:34 PM David G. Johnston <david.g.johnston@xxxxxxxxx> wrote:
On Thu, Jan 20, 2022 at 4:32 PM Ken Tanzer <ken.tanzer@xxxxxxxxx> wrote:


On Thu, Jan 20, 2022 at 8:46 AM David G. Johnston <david.g.johnston@xxxxxxxxx> wrote:
You can always write:

CREATE VIEW cte_view AS
WITH cte AS (...)
SELECT * FROM cte;

And then incorporate that into any queries that require the results of said CTE.


Is there any advantage to still using a CTE inside the view definition, and then selecting it?  Instead of just

CREATE VIEW cte_view AS
(...);

Just curious, in case I'm missing something!


No. That would be tunnel vision and early morning posting on my part.


Though I suspect if the CTE had a MATERIALIZED modifier there would be a difference.  You can force a view to be materialized.

David J.


[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 Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux