Anomie has submitted this change and it was merged.

Change subject: Optimizing Special:DisambiguationPages query to avoid filesort
......................................................................


Optimizing Special:DisambiguationPages query to avoid filesort

Changing the sorting behavior for Special:DisambiguationPages so
that it won't use a filesort. This reduces the query time by a few
orders of magnitude. Tested on en.wiki slave db: Query now runs in
about 0.03 seconds.

Bug: 50832
Change-Id: I1664446ea409710d2542a0a60b0ccb3c4b9b867a
---
M specials/SpecialDisambiguationPages.php
1 file changed, 5 insertions(+), 4 deletions(-)

Approvals:
  Anomie: Verified; Looks good to me, approved



diff --git a/specials/SpecialDisambiguationPages.php 
b/specials/SpecialDisambiguationPages.php
index cb0c3f8..a8d2b90 100644
--- a/specials/SpecialDisambiguationPages.php
+++ b/specials/SpecialDisambiguationPages.php
@@ -17,7 +17,7 @@
        }
 
        function isExpensive() {
-               return true;
+               return false;
        }
 
        function isSyndicated() {
@@ -31,7 +31,7 @@
                                'page_props'
                        ),
                        'fields' => array(
-                               'value' => 'page.page_id',
+                               'value' => 'page_props.pp_page',
                                'namespace' => 'page.page_namespace',
                                'title' => 'page.page_title',
                        ),
@@ -45,11 +45,12 @@
        }
 
        /**
-        * Order the results by namespace and title.
+        * Order the results by page ID.
+        * We don't sort by namespace and title since this would trigger a 
filesort.
         * @return array
         */
        function getOrderFields() {
-               return array( 'namespace', 'title' );
+               return array( 'value' );
        }
 
        function sortDescending() {

-- 
To view, visit https://gerrit.wikimedia.org/r/73008
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1664446ea409710d2542a0a60b0ccb3c4b9b867a
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Disambiguator
Gerrit-Branch: master
Gerrit-Owner: Kaldari <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to