Re: Optimization issue of branching UNION ALL
Andrei Lepikhov <a.lepikhov@postgrespro.ru>
From: Andrey Lepikhov <a.lepikhov@postgrespro.ru>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-12-22T11:59:41Z
Lists: pgsql-hackers
On 22/12/2022 06:50, Tom Lane wrote: >> 2. Iterative passes along the append_rel_list for replacing vars in the >> translated_vars field. I can't grasp real necessity of passing all the >> append_rel_list during flattening of an union all leaf subquery. No one >> can reference this leaf, isn't it? > > After thinking about that for awhile, I believe we can go further: > the containing_appendrel is actually the *only* part of the upper > query that needs to be adjusted. So we could do something like > the attached. > > This passes check-world, but I don't have quite enough confidence > in it to just commit it. Thanks, I have written the letter because of some doubts too. But only one weak point I could imagine - if someday sql standard will be changed. Your code looks better, than previous attempt. -- regards, Andrey Lepikhov Postgres Professional
Commits
-
Avoid O(N^2) cost when pulling up lots of UNION ALL subqueries.
- e42e31243027 16.0 landed
-
Add some recursion and looping defenses in prepjointree.c.
- d572003f74bb 12.14 landed
- 8cd700cc5a67 11.19 landed
- 4fceb454f2df 13.10 landed
- 97431d673992 14.7 landed
- 5beb7881fb27 16.0 landed
- 1a3daa5bb2e0 15.2 landed