Re: Status report on writeable CTEs

Robert Haas <robertmhaas@gmail.com>

From: Robert Haas <robertmhaas@gmail.com>
To: Merlin Moncure <mmoncure@gmail.com>
Cc: Hitoshi Harada <umi.tanuki@gmail.com>, Marko Tiikkaja <marko.tiikkaja@cs.helsinki.fi>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2010-07-21T00:34:08Z
Lists: pgsql-hackers
On Tue, Jul 20, 2010 at 5:13 PM, Merlin Moncure <mmoncure@gmail.com> wrote:
>>>> 2. Use temp table instead of tuplestore list. Since we agreed we need
>>>> to execute each plan one by one starting and shutting down executor,
>>>> it now looks very simple strategy.
>>>
>>> I didn't look at this because I thought using a "tuplestore receiver" in the
>>> portal logic was simple enough.  Any thoughts on how this would work?
>>
>> It's just deconstructing queries like:
>>
>> WITH t AS (INSERT INTO x ... RETURING *)
>> SELECT * FROM t;
>>
>> to
>>
>> CREATE TEMP TABLE t AS INSERT INTO x ... RETURING *;
>> SELECT * FROM t;
>
> Is it acceptable for a wCTE query to manipulate the system catalogs?
> Couldn't this cause performance issues in some cases?

Yeah, I suspect the performance wouldn't be too hot.  I think the idea
of writing into a tuplestore and then reading back out from it is the
way to go.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company