Skip site navigation (1) Skip section navigation (2)

Re: CTE optimization fence on the todo list?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: Daniel Browning <db(at)kavod(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: CTE optimization fence on the todo list?
Date: 2012-10-01 14:07:01
Message-ID: 23258.1349100421@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
Merlin Moncure <mmoncure(at)gmail(dot)com> writes:
> I'm wondering if there are any technical/standards constraints that
> are behind the fencing behavior.

I think the key reason is that we don't want partial execution of DML
operations (ie, INSERT/UPDATE/DELETE inside a WITH).  The fencing
behavior was put in originally because we foresaw adding DML later.

We could possibly relax the rule for WITH SELECT only, but it would
be rather inconsistent, not to mention unpleasant for all the people
who are relying on the current behavior for one reason or another.

Another issue is that if the CTE is scanned multiple times by the outer
query, you really can't optimize it on the basis of any one call site.

			regards, tom lane


In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2012-10-01 14:10:12
Subject: Re: Hash id in pg_stat_statements
Previous:From: Karl O. PincDate: 2012-10-01 14:05:32
Subject: Re: Doc patch, further describe and-mask nature of the permission system v2

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group