From: Brion Vibber Date: Thu, 1 Jan 2004 11:06:33 +0000 (+0000) Subject: Speed improvement; patch by El. Text from sourceforge: X-Git-Tag: 1.3.0beta1~1206 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/bilan.php?a=commitdiff_plain;h=053a858409d34aeb821ee573cf436db0f698d666;p=lhc%2Fweb%2Fwiklou.git 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 --- 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=" .