From: | "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | "Robert Haas" <robertmhaas(at)gmail(dot)com> |
Cc: | "Tatsuo Ishii" <ishii(at)sraoss(dot)co(dot)jp>, ishii(at)postgresql(dot)org, pgsql(at)j-davis(dot)com, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Common Table Expressions (WITH RECURSIVE) patch |
Date: | 2008-09-09 16:51:55 |
Message-ID: | 162867790809090951s6d70ae29r6c19d1c3297df822@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
2008/9/9 Robert Haas <robertmhaas(at)gmail(dot)com>:
>>>> >> My interpretation of 7.13: General Rules: 2.b is that it should be
>>>> >> single evaluation, even if RECURSIVE is present.
>>>> >>
>>>> >> The previous discussion was here:
>>>> >>
>>>> >> http://archives.postgresql.org/pgsql-hackers/2008-07/msg01292.php
>>
>> I am blind, I didn't find any reason, why materialisation isn't useable.
>
> I believe it's because of these two (closely related) problems:
>
> # The basic
> # implementation clearly ought to be to dump the result of the subquery
> # into a tuplestore and then have the upper level read out from that.
> # However, we don't have any infrastructure for having multiple
> # upper-level RTEs reference the same tuplestore. (Perhaps the InitPlan
> # infrastructure could be enhanced in that direction, but it's not ready
> # for non-scalar outputs today.) Also, I think we'd have to teach
> # tuplestore how to support multiple readout cursors. For example,
> # consider
> # WITH foo AS (SELECT ...) SELECT ... FROM foo a, foo b WHERE ...
> # If the planner chooses to do the join as a nested loop then each
> # Scan node needs to keep track of its own place in the tuplestore,
> # concurrently with the other node having a different place.
>
hmm. I solve similar problem in grouping sets :( etc
SELECT ... FROM ... GROUP BY GROUPING SETS (a,b)
is almost same as
With foo AS (SELECT ... FROM) SELECT ... FROM foo GROUP BY a UNION ALL
SELECT ... FROM foo GROUP BY b;
Regards
Pavel
> ...Robert
>
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2008-09-09 16:55:33 | Re: [PATCH] Cleanup of GUC units code |
Previous Message | Hitoshi Harada | 2008-09-09 16:45:21 | Re: Window functions patch v04 for the September commit fest |