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 ' .
'WHERE original.profile_id = ' . $this->id . ' ';
if ($since_id != 0) {
$qry .= 'AND original.id > ' . $since_id . ' ';
$since = Notice::whereSinceId($since_id, 'original.id', 'original.created');
if ($since) {
$qry .= "AND ($since) ";
}
if ($max_id != 0) {
$qry .= 'AND original.id <= ' . $max_id . ' ';
$max = Notice::whereMaxId($max_id, 'original.id', 'original.created');
if ($max) {
$qry .= "AND ($max) ";
}
// NOTE: we sort by fave time, not by notice time!
$qry .= 'ORDER BY original.id DESC ';
$qry .= 'ORDER BY original.created, original.id DESC ';
if (!is_null($offset)) {
$qry .= "LIMIT $limit OFFSET $offset";