Re: pgsql: doc: clarify recursion internal behavior

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-committers <pgsql-committers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgsql: doc: clarify recursion internal behavior
Date: 2022-09-08 15:15:34
Message-ID: CA+TgmoYHkORN2LtHUW3Sp3=aGYiJE3m8ExSL_FOU3LUHb9BjRQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Thu, Sep 8, 2022 at 7:24 AM Peter Eisentraut
<peter(dot)eisentraut(at)enterprisedb(dot)com> wrote:
> On 03.09.22 03:58, Bruce Momjian wrote:
> > doc: clarify recursion internal behavior
>
> - Strictly speaking, this process is iteration not recursion, but
> - <literal>RECURSIVE</literal> is the terminology chosen by the SQL
> standards
> - committee.
> + While <literal>RECURSIVE</literal> allows queries to be specified
> + recursively, internally all queries are evaluated iteratively.
>
> Is that true? Surely there is some recursive behavior in the executor.

I haven't read the patch, but I think the claim shown here is correct.
The executor does recurse in general in that ExecProcNode() is reached
over and over again at different levels of the call stack, but I don't
think that recursive queries cause that to happen any more than it
would otherwise. I think we allocate the first branch of the recursive
query once and then the second one over and over in a loop until we're
done.

--
Robert Haas
EDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2022-09-08 15:30:04 Re: pgsql: doc: clarify recursion internal behavior
Previous Message Tom Lane 2022-09-08 13:58:00 Re: pgsql: Raise a warning if there is a possibility of data from multiple