Update sorting on api/statuses/retweets_of_me; was and remains poorly indexed, but will use updated sorting method.

This commit is contained in:
Brion Vibber 2010-12-17 15:25:19 -08:00
parent 1b90ed564a
commit b80151275a

View File

@ -800,17 +800,17 @@ class User extends Memcached_DataObject
'FROM notice original JOIN notice rept ON original.id = rept.repeat_of ' . 'FROM notice original JOIN notice rept ON original.id = rept.repeat_of ' .
'WHERE original.profile_id = ' . $this->id . ' '; 'WHERE original.profile_id = ' . $this->id . ' ';
if ($since_id != 0) { $since = Notice::whereSinceId($since_id, 'original.id', 'original.created');
$qry .= 'AND original.id > ' . $since_id . ' '; if ($since) {
$qry .= "AND ($since) ";
} }
if ($max_id != 0) { $max = Notice::whereMaxId($max_id, 'original.id', 'original.created');
$qry .= 'AND original.id <= ' . $max_id . ' '; if ($max) {
$qry .= "AND ($max) ";
} }
// NOTE: we sort by fave time, not by notice time! $qry .= 'ORDER BY original.created, original.id DESC ';
$qry .= 'ORDER BY original.id DESC ';
if (!is_null($offset)) { if (!is_null($offset)) {
$qry .= "LIMIT $limit OFFSET $offset"; $qry .= "LIMIT $limit OFFSET $offset";