Thanks for the report. The "queries.txt" repo case was especially helpful. This problem appears to arise when the new UNION ALL optimization is applied repeatedly, causing the size of the parse tree to mushroom. [Check-in 9520bed2bd87dc56](src:/info/9520bed2bd87dc56) disables that optimization if the number of subqueries within the statement grows too large. This is a small change that is appropriate for a patch release. We will be looking closely at this kind of problem (optimizations causing unchecked parse tree growth) during the next release cycle and possibly introducing new and better prevention strategies. If nothing else, we will do something about the new magic number "500" that was inserted by [the patch](src:/info/9520bed2bd87dc56).