Page MenuHomePhabricator

UserSelectQueryBuilder::registered compares actor_user to 0 instead of NULL
Closed, ResolvedPublic1 Estimated Story Points

Description

UserSelectQueryBuilder::registered (L183 of UserSelectQueryBuilder) is implemented by adding the where condition actor_user != 0 to the query builder. However, while this works in theory, the actor_user column either stores a value of NULL or an integer greater or equal to than 1.

While mariadb seems to be able to handle this difference, testing on the commonswiki DB suggests that the query is slower by about 0.2 seconds when using 0 to compare instead of NULL.

Event Timeline

Change #1014087 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/core@master] Compare actor_user to NULL instead of 0 for registered check

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

Change #1014087 merged by jenkins-bot:

[mediawiki/core@master] Compare actor_user to NULL instead of 0 for registered check

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

Opting to skip QA for this task (as this isn't strictly in the sprint goals plus the QA board is rather full). The change should be a no-op anyway and would be hard to QA (because there isn't a usage in the UI).