From 053a858409d34aeb821ee573cf436db0f698d666 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 1 Jan 2004 11:06:33 +0000 Subject: [PATCH] Speed improvement; patch by El. Text from sourceforge: "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 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/maintenance/rebuildrecentchanges.inc b/maintenance/rebuildrecentchanges.inc index 92d2ab5d0d..4f64ce3b62 100644 --- a/maintenance/rebuildrecentchanges.inc +++ b/maintenance/rebuildrecentchanges.inc @@ -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=" . -- 2.20.1