Hi, with the resolution on the previous issue (T137539), performance has increased, however, I have detected an increase on the number of temporary tables:
This maybe circumstantial, and not even related, but there is in some cases a slight performance improvement while using UNION ALL instead of UNION, the first not needing a temporary table and being able to return rows earlier (without waiting for the full query to finish). Please check that they return the same results, I think they do for this particular case, but technically have different logical meanings, so please double check it.
The actual code change would be just to change the parameter from false to true on the unionQueries function. Not that the difference may not be notable (temporary tables are created in memory, and they will be very small), but given the amount of times this is run, and how easy is the change, it may be worth doing it.