pgsql: doc: clarify recursion internal behavior
pgsql: doc: clarify recursion internal behavior
От:
Bruce Momjian <bruce@momjian.us>
Дата:
doc: clarify recursion internal behavior Reported-by: Drew DeVault Discussion: https://postgr.es/m/20211018091720.31299-1-sir@cmpwn.com Backpatch-through: 10 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/8ec6a4ef3c3a6aa08f2cc235fab8c691a8b2f341 Modified Files -------------- doc/src/sgml/queries.sgml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
Re: pgsql: doc: clarify recursion internal behavior
От:
Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Дата:
On 03.09.22 03:58, Bruce Momjian wrote: > doc: clarify recursion internal behavior - Strictly speaking, this process is iteration not recursion, but - RECURSIVE is the terminology chosen by the SQL standards - committee. + While RECURSIVE allows queries to be specified + recursively, internally all queries are evaluated iteratively. Is that true? Surely there is some recursive behavior in the executor.
Re: pgsql: doc: clarify recursion internal behavior
От:
Robert Haas <robertmhaas@gmail.com>
Дата:
On Thu, Sep 8, 2022 at 7:24 AM Peter Eisentraut wrote: > On 03.09.22 03:58, Bruce Momjian wrote: > > doc: clarify recursion internal behavior > > - Strictly speaking, this process is iteration not recursion, but > - RECURSIVE is the terminology chosen by the SQL > standards > - committee. > + While RECURSIVE 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
Re: pgsql: doc: clarify recursion internal behavior
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Robert Haas writes: > On Thu, Sep 8, 2022 at 7:24 AM Peter Eisentraut > wrote: >> On 03.09.22 03:58, Bruce Momjian wrote: >>> + While RECURSIVE 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. I'd be happier if it read "such queries" instead of "all queries". The latter is an extremely broad claim, and you have to ignore cases like recursive SQL functions in order to even argue it's true. regards, tom lane
Re: pgsql: doc: clarify recursion internal behavior
On Thu, Sep 8, 2022 at 11:30:04AM -0400, Tom Lane wrote: > Robert Haas writes: > > On Thu, Sep 8, 2022 at 7:24 AM Peter Eisentraut > > wrote: > >> On 03.09.22 03:58, Bruce Momjian wrote: > >>> + While RECURSIVE 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. > > I'd be happier if it read "such queries" instead of "all queries". > The latter is an extremely broad claim, and you have to ignore cases > like recursive SQL functions in order to even argue it's true. Done in the attached applied patch. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Indecision is a decision. Inaction is an action. Mark Batterson