Re: CTE materializing sets?

From: Serge Fonville <serge(dot)fonville(at)gmail(dot)com>
To: Craig Ringer <ringerc(at)ringerc(dot)id(dot)au>
Cc: Liam Caffrey <liam(dot)caffrey(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: CTE materializing sets?
Date: 2012-10-09 09:53:10
Message-ID: CAOAS_+K0cWDma4+51gdyJVBAE9Jc-8C=POgV1-_o09_x4OKEZQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

This indeed is a very interesting question.

At http://wiki.postgresql.org/wiki/CTEReadme it seems to suggest that a CTE
is just rewritten and the resulting query is executed.

Kind regards/met vriendelijke groet,

Serge Fonville

http://www.sergefonville.nl

Convince Microsoft!
They need to add TRUNCATE PARTITION in SQL Server
https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table

2012/10/9 Craig Ringer <ringerc(at)ringerc(dot)id(dot)au>

> On 10/06/2012 08:45 AM, Liam Caffrey wrote:
>
>> Hi,
>>
>> If I run a CTE does that materialize the resulting data in the same (or
>> a similar) way as if I created a temp table and referred to that
>> instead? Or does the CTE keep the set in memory?
>>
>
> Really good question, I too would be interested in this.
>
> I'd expect it'd materialize to RAM if the result is within `work_mem` but
> I'd love to know for sure.
>
> --
> Craig Ringer
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/**mailpref/pgsql-general<http://www.postgresql.org/mailpref/pgsql-general>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tomas Vondra 2012-10-09 10:08:55 Re: CTE materializing sets?
Previous Message Craig Ringer 2012-10-09 09:48:42 Re: CTE materializing sets?