β T313142 Improve performance of EventsPager::getEventPageFromRow
Page Menu
Phabricator
Create Task
Maniphest
T313142
Improve performance of EventsPager::getEventPageFromRow
Closed, Resolved
Public
Actions
Edit Task
Edit Related Tasks...
Create Subtask
Edit Parent Tasks
Edit Subtasks
Merge Duplicates In
Close As Duplicate
Edit Related Objects...
Edit Commits
Edit Mocks
Mute Notifications
Protect as security issue
Assigned To
Daimona
Authored By
Daimona
Jul 16 2022, 12:05 AM
2022-07-16 00:05:38 (UTC+0)
Tags
CampaignEvents
(Backlog)
Campaign-Registration
(Backlog)
Connection-Team (Connection-Current-Sprint)
(Done π)
MW-1.39-notes (1.39.0-wmf.28; 2022-09-05)
Referenced Files
None
Subscribers
Aklapper
Daimona
vaughnwalters
Description
The method will try to look up a wikipage for each row, which can result in a lot of queries. We should improve this, e.g. using LinkBatch (at least for local pages) or something.
Acceptance criteria
When visiting Special:MyEvents with a large number of event, only one DB query is made to lookup all local event pages at once. The query should look like the following:
SELECT
page_id
page_namespace
page_title
page_is_redirect
page_is_new
page_latest
page_touched
page_len
page_content_model
FROM
page
WHERE
page_namespace
1728
AND
page_title
IN
'Event 1'
'Event 2'
...
Note that we will still make one query for each non-local page.
Details
Related Changes in Gerrit:
Subject
Repo
Branch
Lines +/-
Use LinkBatch with local pages in EventsPager for performance
mediawiki/extensions/CampaignEvents
master
+40
-2
Customize query in gerrit
Related Objects
Mentions
Mentioned In
rUCAM17e2a3e33943: Use LinkBatch with local pages in EventsPager for performance
Event Timeline
Daimona
created this task.
Jul 16 2022, 12:05 AM
2022-07-16 00:05:38 (UTC+0)
Restricted Application
added a subscriber:
Aklapper
View Herald Transcript
Jul 16 2022, 12:05 AM
2022-07-16 00:05:39 (UTC+0)
Daimona
claimed this task.
Aug 29 2022, 11:50 PM
2022-08-29 23:50:02 (UTC+0)
Daimona
edited projects, added
Connection-Team (Connection-Current-Sprint)
; removed
Connection-Team
Daimona
updated the task description.
(Show Details)
Aug 29 2022, 11:55 PM
2022-08-29 23:55:30 (UTC+0)
gerritbot
added a comment.
Aug 29 2022, 11:57 PM
2022-08-29 23:57:20 (UTC+0)
Comment Actions
Change 827604 had a related patch set uploaded (by Daimona Eaytoy; author: Daimona Eaytoy):
[mediawiki/extensions/CampaignEvents@master] Use LinkBatch with local pages in EventsPager for performance
gerritbot
added a project:
Patch-For-Review
Aug 29 2022, 11:57 PM
2022-08-29 23:57:21 (UTC+0)
Daimona
moved this task from
Upcoming / refining π‘
to
Code Review π¬
on the
Connection-Team (Connection-Current-Sprint)
board.
Aug 29 2022, 11:57 PM
2022-08-29 23:57:57 (UTC+0)
gerritbot
added a comment.
Aug 31 2022, 3:49 AM
2022-08-31 03:49:16 (UTC+0)
Comment Actions
Change 827604
merged
by jenkins-bot:
[mediawiki/extensions/CampaignEvents@master] Use LinkBatch with local pages in EventsPager for performance
Daimona
mentioned this in
rUCAM17e2a3e33943: Use LinkBatch with local pages in EventsPager for performance
Aug 31 2022, 3:49 AM
2022-08-31 03:49:23 (UTC+0)
ReleaseTaggerBot
added a project:
MW-1.39-notes (1.39.0-wmf.28; 2022-09-05)
Aug 31 2022, 4:00 AM
2022-08-31 04:00:37 (UTC+0)
Maintenance_bot
removed a project:
Patch-For-Review
Aug 31 2022, 4:30 AM
2022-08-31 04:30:01 (UTC+0)
Daimona
moved this task from
Code Review π¬
to
QA π
on the
Connection-Team (Connection-Current-Sprint)
board.
Aug 31 2022, 11:39 AM
2022-08-31 11:39:28 (UTC+0)
vaughnwalters
subscribed.
Aug 31 2022, 3:52 PM
2022-08-31 15:52:25 (UTC+0)
Comment Actions
Testing locally and am seeing this query in the debugging toolbar on
Special:MyEvents
. I believe this is correct but is this what you would be expecting to see
@Daimona
unknown: SELECT page_id,page_namespace,page_title,page_is_redirect,page_is_new,page_latest,page_touched,page_len,page_content_model,page_namespace,page_title FROM page WHERE (page_namespace = 1728 AND page_title IN (β9β,β35β,β36β,β37β,β38β,β39β,β40β,β41β,β42β,β43β,β44β,β45β,β46β,β47β,β48β,β49β,β50β,β51β,β20β,β25β,β15β,β22β,β23β,β24β,β26β,β30β,β31β,β57β,β59β,βV16β,βV14β,β52β,β60β,β55β,β61β,β71β,β54β,β63β,βV18β,β62β,βTEST1β,β21β,β27β,β56β,βV20β,β34β,βV15β,β14β,β6β,β7β,β28β) )
This is the full list of queries that are currently run on
Special:MyEvents
on my local.
1 unknown: PRAGMA case_sensitive_like = 1 0.0000ms Wikimedia\Rdbms\DatabaseSqlite::open
2 unknown: PRAGMA temp_store = MEMORY 0.0000ms Wikimedia\Rdbms\DatabaseSqlite::open
3 unknown: BEGIN DEFERRED 0.0000ms Wikimedia\Rdbms\Database::beginIfImplied (MediaWiki\User\UserOptionsManager::loadOptionsFromDb)
4 unknown: SELECT up_property,up_value FROM user_properties WHERE up_user = 3 9.0000ms MediaWiki\User\UserOptionsManager::loadOptionsFromDb
5 unknown: SELECT user_id,user_name FROM user WHERE user_name = 'V' 1.0000ms LocalIdLookup::lookupUserNames
6 unknown: SELECT event_id,event_name,event_page_namespace,event_page_title,event_page_prefixedtext,event_page_wiki,event_status,event_start,event_meeting_type,num_participants FROM (SELECT event_id,event_name,event_page_namespace,event_page_title,event_page_prefixedtext,event_page_wiki,event_status,event_start,event_meeting_type,COUNT(cep_id) AS "num_participants" FROM campaign_events LEFT JOIN ce_participants ON ((event_id=cep_event_id) AND cep_unregistered_at IS NULL) JOIN ce_organizers ON ((event_id=ceo_event_id) AND ceo_user_id = 3) WHERE event_deleted_at IS NULL GROUP BY cep_event_id,event_id,event_name,event_page_namespace,event_page_title,event_page_prefixedtext,event_page_wiki,event_status,event_start,event_meeting_type ) "tmp" ORDER BY event_start,event_name,event_id LIMIT 51 3.0000ms IndexPager::buildQueryInfo (MediaWiki\Extension\CampaignEvents\Pager\EventsPager)
7 unknown: SELECT page_id,page_namespace,page_title,page_is_redirect,page_is_new,page_latest,page_touched,page_len,page_content_model,page_namespace,page_title FROM page WHERE (page_namespace = 1728 AND page_title IN ('9','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','20','25','15','22','23','24','26','30','31','57','59','V16','V14','52','60','55','61','71','54','63','V18','62','TEST1','21','27','56','V20','34','V15','14','6','7','28') ) 2.0000ms LinkBatch::doQuery (for MediaWiki\Extension\CampaignEvents\Pager\EventsPager::preprocessResults)
8 unknown: COMMIT 0.0000ms MediaWiki::preOutputCommit
9 unknown: BEGIN DEFERRED 0.0000ms Wikimedia\Rdbms\Database::beginIfImplied (MediaWiki\User\UserGroupManager::getUserGroupMemberships)
10 unknown: SELECT ug_user,ug_group,ug_expiry FROM user_groups WHERE ug_user = 3 2.0000ms MediaWiki\User\UserGroupManager::getUserGroupMemberships
11 unknown: SELECT ipb_id,ipb_address,ipb_timestamp,ipb_auto,ipb_anon_only,ipb_create_account,ipb_enable_autoblock,ipb_expiry,ipb_deleted,ipb_block_email,ipb_allow_usertalk,ipb_parent_block_id,ipb_sitewide,ipb_by_actor,ipblocks_actor.actor_user AS "ipb_by",ipblocks_actor.actor_name AS "ipb_by_text",comment_ipb_reason.comment_text AS "ipb_reason_text",comment_ipb_reason.comment_data AS "ipb_reason_data",comment_ipb_reason.comment_id AS "ipb_reason_cid" FROM ipblocks JOIN actor "ipblocks_actor" ON ((actor_id=ipb_by_actor)) JOIN comment "comment_ipb_reason" ON ((comment_ipb_reason.comment_id = ipb_reason_id)) WHERE ipb_address IN ('V','172.24.0.1') OR ((ipb_range_start LIKE 'AC18%' ESCAPE '`' ) AND (ipb_range_start <= 'AC180001') AND (ipb_range_end >= 'AC180001')) 1.0000ms MediaWiki\Block\DatabaseBlock::newLoad
12 unknown: SELECT page_id,page_namespace,page_title,page_is_redirect,page_is_new,page_latest,page_touched,page_len,page_content_model,page_namespace,page_title FROM page WHERE (page_namespace = 2 AND page_title = 'V') OR (page_namespace = 3 AND page_title = 'V') OR (page_namespace = 4 AND page_title IN ('Privacy_policy','About','General_disclaimer') ) 1.0000ms LinkBatch::doQuery (for Skin::preloadExistence)
13 unknown: SELECT user_id FROM user_newtalk WHERE user_id = 3 LIMIT 1 0.0000ms MediaWiki\User\TalkPageNotificationManager::dbCheckNewUserMessages
14 unknown: SELECT actor_id,actor_user,actor_name FROM actor WHERE actor_name = 'V' LIMIT 1 1.0000ms User::load
15 unknown: SELECT user_editcount FROM user WHERE user_id = 3 LIMIT 1 1.0000ms MediaWiki\User\UserEditTracker::getUserEditCount
16 unknown: SELECT actor_id,actor_user,actor_name FROM actor WHERE actor_name = 'V' LIMIT 1 0.0000ms User::load
Daimona
added a comment.
Aug 31 2022, 4:04 PM
2022-08-31 16:04:34 (UTC+0)
Comment Actions
In
T313142#8203118
@vaughnwalters
wrote:
Testing locally and am seeing this query in the debugging toolbar on
Special:MyEvents
. I believe this is correct but is this what you would be expecting to see
@Daimona
Yup, LGTM. The other queries you're seeing are not related to the work done here.
vaughnwalters
closed this task as
Resolved
Aug 31 2022, 4:06 PM
2022-08-31 16:06:01 (UTC+0)
vaughnwalters
moved this task from
QA π
to
Done π
on the
Connection-Team (Connection-Current-Sprint)
board.
Log In to Comment
Content licensed under Creative Commons Attribution-ShareAlike (CC BY-SA) 4.0 unless otherwise noted; code licensed under GNU General Public License (GPL) 2.0 or later and other open source licenses. By using this site, you agree to the Terms of Use, Privacy Policy, and Code of Conduct.
Wikimedia Foundation
Code of Conduct
Disclaimer
CC-BY-SA
GPL
Credits