Re: wCTE behaviour

From: Marko Tiikkaja <marko(dot)tiikkaja(at)cs(dot)helsinki(dot)fi>
To: Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Yeb Havinga <yebhavinga(at)gmail(dot)com>, David Fetter <david(at)fetter(dot)org>
Subject: Re: wCTE behaviour
Date: 2010-11-14 18:01:55
Message-ID: 4CE02413.3000302@cs.helsinki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2010-11-14 5:28 PM +0200, Hitoshi Harada wrote:
> 2010/11/14 Marko Tiikkaja<marko(dot)tiikkaja(at)cs(dot)helsinki(dot)fi>:
>> .. and a wild patch appears.
>
> Could you update wiki on this feature if you think we've reached the consensus?

You're probably referring to
http://archives.postgresql.org/pgsql-hackers/2010-11/msg00660.php
which was unfortunately just me talking too soon. There still doesn't
appear to be a consensus on the difference (if any) between these queries:

WITH t AS (DELETE FROM foo RETURNING *)
SELECT 1 LIMIT 0; -- unreferenced CTE

WITH t AS (DELETE FROM foo RETURNING *)
SELECT 1 FROM t LIMIT 0; -- referenced, but not read

WITH t AS (DELETE FROM foo RETURNING *)
SELECT 1 FROM t LIMIT 1; -- referenced, but only partly read

WITH t AS (DELETE FROM foo RETURNING *)
SELECT 1 FROM t t1, t t2; -- referenced, read multiple times

In my opinion, all of these should have the same effect: DELETE all rows
from "foo". Any other option means we're going to have trouble
predicting how a query is going to behave.

As far as I know, we do have a consensus that the order of execution
should be an implementation detail, and that the statements should
always be executed in the exact same snapshot (i.e. no CID bump between).

> Also, wrapping up the discussion like pros& cons on the different
> execution models helps not only the advance discussions but also
> reviews of this patch.

Do you mean between the "execute in order, bump CID" and "execute in
whatever order but to completion" behaviours?

Regards,
Marko Tiikkaja

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marko Tiikkaja 2010-11-14 18:07:22 Re: wCTE behaviour
Previous Message Scott Ribe 2010-11-14 17:38:36 streaming replication feature request