https://bugzilla.wikimedia.org/show_bug.cgi?id=16632

           Summary: updateArticleCount.inc.php can be made significantly
                    more efficient
           Product: MediaWiki
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: Maintenance scripts
        AssignedTo: [email protected]
        ReportedBy: [email protected]


The query in updateArticleCount.inc.php's makeSql() function can be made faster
an less RAM-intensive.  It currently queries for a ton of rows, then counts the
number of rows in the result.

The current query is:
return "SELECT DISTINCT page_namespace,page_title FROM $page,$pagelinks " .
                        "WHERE pl_from=page_id and page_namespace IN ( $nsset )
" .
                        "AND page_is_redirect = 0 AND page_len > 0";
but could be changed to:
return "SELECT COUNT(DISTINCT page_namespace,page_title) FROM $page,$pagelinks
" .
                        "WHERE pl_from=page_id and page_namespace IN ( $nsset )
" .
                        "AND page_is_redirect = 0 AND page_len > 0";

The code in the count() function would have to be updated also.  Instead of
                        $count = $this->dbr->numRows( $res );
                        $this->dbr->freeResult( $res );
                        return $count;
it could be changed to:
                        $row = $this->dbr->fetchObject( $res );
                        $this->dbr->freeResult( $res );
                        return (int)$row->count;


-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to