Re: How to share the result data of separated plan
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Hitoshi Harada <umi.tanuki@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>, Marko Tiikkaja <marko.tiikkaja@cs.helsinki.fi>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2010-11-08T17:32:16Z
Lists: pgsql-hackers
Hitoshi Harada <umi.tanuki@gmail.com> writes: > 2010/11/9 Tom Lane <tgl@sss.pgh.pa.us>: >> My opinion is still the same as here: >> http://archives.postgresql.org/pgsql-hackers/2010-02/msg00688.php > 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. Consensus according to who? It's at least as consistent for all the queries to start from the same snapshot, meaning that x and z would produce the same results (independent of what y does). It might be worth inspecting the SQL2011 draft to see if they provide any guidance on what ought to happen here. regards, tom lane