Re: Optimization issue of branching UNION ALL
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andrey Lepikhov <a.lepikhov@postgrespro.ru>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-12-22T16:05:36Z
Lists: pgsql-hackers
Andrey Lepikhov <a.lepikhov@postgrespro.ru> writes: > 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. Yeah, if they ever decide that LATERAL should be allowed to reference a previous sub-query of UNION ALL, that'd probably break this. But it'd break a lot of other code too, so I'm not going to worry about it. I pushed the main fix to HEAD only, and the recursion checks to all branches. regards, tom lane
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