From a52a3acd8bfcc25913cdcbf4bf4781dcd72b5aa7 Mon Sep 17 00:00:00 2001 From: Domas Mituzas Date: Tue, 8 May 2007 15:14:33 +0000 Subject: [PATCH] enforce join order for whatlinkshere queries - avoid filesorts at a cost of scanning more records for damn namespace selector --- includes/SpecialWhatlinkshere.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/includes/SpecialWhatlinkshere.php b/includes/SpecialWhatlinkshere.php index d84326a8ca..a11e9d42c9 100644 --- a/includes/SpecialWhatlinkshere.php +++ b/includes/SpecialWhatlinkshere.php @@ -112,6 +112,11 @@ class WhatLinksHerePage { // Read an extra row as an at-end check $queryLimit = $limit + 1; + + // enforce join order, sometimes namespace selector may + // trigger filesorts which are far less efficient than scanning many entries + $options[] = 'STRAIGHT_JOIN'; + $options['LIMIT'] = $queryLimit; $fields = array( 'page_id', 'page_namespace', 'page_title', 'page_is_redirect' ); -- 2.20.1