Page MenuHomePhabricator

Use UNION ALL instead of UNION for bulk wbc_entity_usage queries
Closed, ResolvedPublic

Description

Hi, with the resolution on the previous issue (T137539), performance has increased, however, I have detected an increase on the number of temporary tables:

Screenshot from 2016-06-16 17:49:41.png (473×2 px, 81 KB)

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.

Event Timeline

jcrespo updated the task description. (Show Details)

Change 294865 had a related patch set uploaded (by Hoo man):
Use UNION ALL in EntityUsageTable::getUsedEntityIdStrings

https://gerrit.wikimedia.org/r/294865

Change 294865 merged by jenkins-bot:
Use UNION ALL in EntityUsageTable::getUsedEntityIdStrings

https://gerrit.wikimedia.org/r/294865