On 11/11/07, vasilievvv@svn.wikimedia.org vasilievvv@svn.wikimedia.org wrote:
$use_index = $dbr->useIndexClause( 'page_random' );
$page = $dbr->tableName( 'page' );
$categorylinks = $dbr->tableName( 'categorylinks' );
$category = $dbr->addQuotes( $this->category );
$extra = $wgExtraRandompageSQL ? "AND ($wgExtraRandompageSQL)" : "";
$sql = "SELECT page_namespace, page_title
FROM $page $use_index JOIN $categorylinks ON page_id = cl_from
WHERE page_is_redirect = 0
AND page_random >= $randstr
AND cl_to = $category
$extra
ORDER BY page_random";
I'm not sure this is at all acceptable. The toolserver on the enwiki database, at least, appears to filesort the contents of the category in categorylinks. It may be "good enough" for small categories, but it's far from ideal and might result in significant slowdown for large categories like Living people. I would recommend requiring $wgMiserMode to be false until a more efficient implementation can be developed.
wikitech-l@lists.wikimedia.org