Page MenuHomePhabricator

updateMenteeData.php submits a lot of DB queries
Closed, ResolvedPublic

Description

Took the binlog of the primary db and ordered them by the number of invocation (it's not a great metric but better than nothing):

MediaWiki\Extension\OATHAuth\Hook\LoadExtensionSchemaUpdates\UpdateTables::switchTOTPScratchTokensToArray www-data@deploy... 14784
GrowthExperiments\Maintenance\UpdateMenteeData::execute www-data@deploy... 6933
Wikimedia\DependencyStore\SqlModuleDependencyStore::storeMulti 5733
DatabaseUpdater::purgeCache www-data@deploy... 2160
User::saveSettings 2032

We don't need to run that many write queries. @Ladsgroup suggested to ditch upsert, manually check for row existance/current data, and do nothing/insert/update as needed.

Event Timeline

Change 723296 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/GrowthExperiments@master] updateMenteeData.php: Decrease number of queries made

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

Change 723296 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] updateMenteeData.php: Decrease number of write queries made

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

Change 723782 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/GrowthExperiments@wmf/1.38.0-wmf.1] updateMenteeData.php: Decrease number of write queries made

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

Change 723782 merged by Urbanecm:

[mediawiki/extensions/GrowthExperiments@wmf/1.38.0-wmf.1] updateMenteeData.php: Decrease number of write queries made

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

Mentioned in SAL (#wikimedia-operations) [2021-09-27T14:36:55Z] <urbanecm@deploy1002> Synchronized php-1.38.0-wmf.1/extensions/GrowthExperiments/: 08f1e73: 3b154db: GrowthExperiments backports (T290609, T291658) (duration: 00m 58s)

Verified in beta's binlogs, looks okay now.