Re: How to share the result data of separated plan

From: Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Marko Tiikkaja <marko(dot)tiikkaja(at)cs(dot)helsinki(dot)fi>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: How to share the result data of separated plan
Date: 2010-11-08 17:16:33
Message-ID: AANLkTinp7R8wU-QgtqkZds0LryUy=_zV8R9kiV6cdsma@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2010/11/9 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Sun, Nov 7, 2010 at 1:08 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> I guess I shoulda been paying closer attention :-(.  That really, really
>>> seems like fundamentally the wrong direction.  What was it that was
>>> unfixable about the other way?  If it is unfixable, should we revert
>>> ModifyTable?
>
>> The relevant thread is here:
>> http://archives.postgresql.org/pgsql-hackers/2010-02/msg00783.php
>
> My opinion is still the same as here:
> http://archives.postgresql.org/pgsql-hackers/2010-02/msg00688.php
>
> namely, that all we should be worrying about is a tuplestore full of
> RETURNING tuples.  Any other side-effects of a DML subquery should
> *not* be visible to the calling query, and therefore all this argument
> about snapshots and seqscan limits is beside the point.

Current consensus says:

WITH x AS (SELECT count(*) FROM t), y AS (DELETE FROM t), z AS (SELECT
count(*) FROM t) SELECT x.count, z.count FROM x, z;

should return 0 for z.count but some number of original rows for
x.count. So I think you need to read the underlying table itself as
well as the emitted data of ModfyTable (or the result of any writeable
CTE queries) in *predictable order*. To make it happen, we need CCI in
each execution of child plans.

Regards,

--
Hitoshi Harada

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-11-08 17:26:22 Re: How to share the result data of separated plan
Previous Message Marko Tiikkaja 2010-11-08 17:03:10 Re: How to share the result data of separated plan