public inbox for [email protected]
help / color / mirror / Atom feedFrom: [email protected]
To: Greg Sabino Mullane <[email protected]>
Cc: [email protected]
Subject: Re: Abitity to identify the current iteration in a recursive SELECT (feature request)
Date: Thu, 19 Dec 2024 11:16:47 +0200
Message-ID: <CAGH1kmxExkBY-tW8edPoN7XwwJuCgBpJs+5Fs5nEN5Fd1yFv4A@mail.gmail.com> (raw)
In-Reply-To: <CAKAnmmL34MAd436EJxXx6vV-3QHQvQDr3TQb5AjbuyzEwm=GKw@mail.gmail.com>
References: <CAGH1kmyB7D7+xj4=HkEPPNoK1irm4OdgOMZe-GDqFWsLAa9m-A@mail.gmail.com>
<CAKAnmmL34MAd436EJxXx6vV-3QHQvQDr3TQb5AjbuyzEwm=GKw@mail.gmail.com>
Please read among your lines.
În mie., 18 dec. 2024 la 16:07, Greg Sabino Mullane <[email protected]> a
scris:
> Do you mean something like "... WHERE pg_magic_iteration_number < 10"?
> Looking at the source code, I don't see a trivial way to accomplish that.
>
Oh, I disagree, just told you that the iteration number is readily
available in the field computed by the SEARCH BREADTH FIRST clause.
> Maintaining the count as a column in your select is still the canonical
> way. As someone who writes a lot of recursive CTEs (especially each
> December!), I'm not sure how useful this feature would be, as the number of
> loops is rarely the criteria for ending the iterations.
>
I never said I use the iteration number to end the process, I need it to
pick the right table to be joined. If the iteration number was stored
in a *working
table* column, I would be forced to perform a LATERAL join, which
recomputes the *same joined table* again and again for every row in the
working table.
>
> Certainly the best solution is to use pl/pgsql, which gets you iterative
> loops, lots of introspection and ways to break out of the loop, and even
> true recursion.
>
Thought about it, of course, but I'm pretty sure that plain JOINs are
quicker than linear search loops written in pl/pgsql (remember I need to
intersect an dynamic number of arrays) .
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Abitity to identify the current iteration in a recursive SELECT (feature request)
In-Reply-To: <CAGH1kmxExkBY-tW8edPoN7XwwJuCgBpJs+5Fs5nEN5Fd1yFv4A@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox