Speed improvement; patch by El. Text from sourceforge:
authorBrion Vibber <brion@users.mediawiki.org>
Thu, 1 Jan 2004 11:06:33 +0000 (11:06 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Thu, 1 Jan 2004 11:06:33 +0000 (11:06 +0000)
"rebuildrecentchanges" can be accelerated considerably.
I've tested the new version with the German database.
It yields exactly the same result as the old version
and is about 5 times faster.

(I know this improvement will be obsolete once the
table structure is changed so that the revisions table
contains the id of the previous revision. But who knows
when that'll happen. ;-)

de:Benutzer:El

maintenance/rebuildrecentchanges.inc

index 92d2ab5..4f64ce3 100644 (file)
@@ -85,13 +85,14 @@ function rebuildRecentChangesTablePass2()
 
                        $id = $obj2->cur_id;
                        $ct = $obj2->cur_timestamp;
+
+                       $sql = "SELECT old_id FROM old WHERE old_namespace={$ns} " .
+                         "AND old_title='{$title}' ORDER BY old_timestamp DESC";
+                       $res2 = wfQuery( $sql, DB_WRITE );
+                       $numRows = wfNumRows( $res2 );
                }
-               $sql = "SELECT old_id FROM old WHERE old_namespace={$ns} " .
-                 "AND old_title='{$title}' AND old_timestamp < '" .
-                 "{$obj->rc_timestamp}' ORDER BY old_timestamp DESC LIMIT 1";
-               $res2 = wfQuery( $sql, DB_WRITE );
 
-               if ( 0 != wfNumRows( $res2 ) ) {
+               if ( 0 != $numRows-- ) {
                        $obj2 = wfFetchObject( $res2 );
 
                        $sql = "UPDATE recentchanges SET rc_cur_id={$id},rc_cur_time=" .