From f7fb00c8f8702ff5d4c7974474bb4e6bd5c9125f Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Tue, 23 Oct 2018 17:21:28 -0700 Subject: [PATCH] Fix slow query counting by unindexed field ar_page_id Bug: T207530 Change-Id: I81a70ca03fd219d2e96b17714645d9cc4f99b3b9 --- includes/page/WikiPage.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index 081af19511..18797d9443 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -2727,8 +2727,13 @@ class WikiPage implements Page, IDBAccessObject { // in the job queue to avoid simultaneous deletion operations would add overhead. // Number of archived revisions cannot be known beforehand, because edits can be made // while deletion operations are being processed, changing the number of archivals. - $archivedRevisionCount = $dbw->selectRowCount( - 'archive', '1', [ 'ar_page_id' => $id ], __METHOD__ + $archivedRevisionCount = $dbw->selectField( + 'archive', 'COUNT(*)', + [ + 'ar_namespace' => $this->getTitle()->getNamespace(), + 'ar_title' => $this->getTitle()->getDBkey(), + 'ar_page_id' => $id + ], __METHOD__ ); // Clone the title and wikiPage, so we have the information we need when -- 2.20.1