Re: WITH RECUSIVE patches 0723

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: WITH RECUSIVE patches 0723
Date: 2008-07-28 18:57:16
Message-ID: 87myk1rg4z.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

>>>>> "Tom" == Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

[snip spec]

Just out of curiosity, since I don't have a copy of the spec handy, how
does the language for WITH compare to that for views?

Tom> I think this is a "must fix" because of the point about volatile
Tom> functions --- changing it later will result in user-visible
Tom> semantics changes, so we have to get it right the first time.

I strongly disagree that this should be a blocking issue - the patch
as it stands is an insanely useful feature, allowing many real-world
queries to work which simply were not possible before without
resorting to procedural code or awkward database designs.

Tom> This isn't going to be a particularly simple fix :-(. The basic
Tom> implementation clearly ought to be to dump the result of the
Tom> subquery into a tuplestore and then have the upper level read
Tom> out from that.

Which will be a serious pessimization in many common cases if you do
it all the time. Googling for examples of non-recursive WITH queries
shows that it is very widely used for clarity or convenience, in
contexts where you _don't_ want materialization.

Recursive WITH queries that self-join the recursion result seem to be
rare in practice.

--
Andrew (irc:RhodiumToad)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-07-28 19:15:13 Re: WITH RECUSIVE patches 0723
Previous Message Tom Lane 2008-07-28 18:49:01 Re: WITH RECUSIVE patches 0723

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2008-07-28 19:15:13 Re: WITH RECUSIVE patches 0723
Previous Message Tom Lane 2008-07-28 18:49:01 Re: WITH RECUSIVE patches 0723