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:

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 created this task.Jun 16 2016, 3:55 PM
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

Addshore moved this task from incoming to ready to go on the Wikidata board.Jun 22 2016, 1:00 PM
hoo closed this task as Resolved.Oct 7 2016, 5:43 PM