On 2022-Sep-30, Yugo NAGATA wrote: > Well, I still don't understand why we need to prepare only "the > commands within a pipeline" before starting pipeline. In the current > behavior, the entire script is prepared in advance just before executing > the first SQL command in the script, instead of preparing each command > one by one. This patch also prepare the entire script in advance, so > there is no behavioural change in this sense. > > However, there are a few behavioural changes. One is that the preparation > is not counted in the command performance statistics as Fabien mentioned. > Another is that all meta-commands including \shell and \sleep etc. are > executed before the preparation. > > To reduce impact of these changes, I updated the patch to prepare the > commands just before executing the first SQL command or \startpipeline > meta-command instead of at the beginning of the script.
I propose instead the following: each command is prepared just before it's executed, as previously, and if we see a \startpipeline, then we prepare all commands starting with the one just after, and until the \endpipeline. I didn't test additional cases other than the one you submitted. Testing this I noticed that pg_log_debug et al don't support multithreading very well -- the lines are interspersed. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/