From: Brion Vibber Date: Mon, 26 Jan 2004 22:42:49 +0000 (+0000) Subject: Remove DISTINCTs and ORDER BY. If the tables are right distinct is unneccesary, and... X-Git-Tag: 1.3.0beta1~1090 X-Git-Url: http://git.cyclocoop.org/%22.%28%24lien.?a=commitdiff_plain;h=f26d95a72938620e01129e2ce239c449c086a0d6;p=lhc%2Fweb%2Fwiklou.git Remove DISTINCTs and ORDER BY. If the tables are right distinct is unneccesary, and ORDER BY slows things down unnecessarily. Taking these two out enables skipping temporary tables and filesort for potentially very large numbers of links. --- diff --git a/includes/SpecialWhatlinkshere.php b/includes/SpecialWhatlinkshere.php index d7bfa3d69f..35dab264cd 100644 --- a/includes/SpecialWhatlinkshere.php +++ b/includes/SpecialWhatlinkshere.php @@ -27,7 +27,7 @@ function wfSpecialWhatlinkshere($par = NULL) $isredir = " (" . wfMsg( "isredirect" ) . ")\n"; if ( 0 == $id ) { - $sql = "SELECT DISTINCT bl_from FROM brokenlinks WHERE bl_to='" . + $sql = "SELECT bl_from FROM brokenlinks WHERE bl_to='" . wfStrencode( $nt->getPrefixedDBkey() ) . "' LIMIT 500"; $res = wfQuery( $sql, DB_READ, $fname ); @@ -67,7 +67,7 @@ function wfShowIndirectLinks( $level, $lid ) global $wgOut, $wgUser; $fname = "wfShowIndirectLinks"; - $sql = "SELECT DISTINCT l_from FROM links WHERE l_to={$lid} ORDER BY l_from LIMIT 500"; + $sql = "SELECT l_from FROM links WHERE l_to={$lid} LIMIT 500"; $res = wfQuery( $sql, DB_READ, $fname ); if ( 0 == wfNumRows( $res ) ) {