From: Tim Starling Date: Wed, 24 Oct 2018 00:21:28 +0000 (-0700) Subject: Fix slow query counting by unindexed field ar_page_id X-Git-Tag: 1.34.0-rc.0~3684 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/membres/fiche.php?a=commitdiff_plain;h=f7fb00c8f8702ff5d4c7974474bb4e6bd5c9125f;p=lhc%2Fweb%2Fwiklou.git Fix slow query counting by unindexed field ar_page_id Bug: T207530 Change-Id: I81a70ca03fd219d2e96b17714645d9cc4f99b3b9 --- 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