Improve networkpublic_timeline SQL performance

- Use thread.iid for max_id and ordering
This commit is contained in:
Hypolite Petovan 2017-12-17 10:06:12 -05:00
parent dcc0a77949
commit cdd5bd5615

View file

@ -1691,7 +1691,7 @@ function api_statuses_networkpublic_timeline($type)
$sql_extra = ''; $sql_extra = '';
if ($max_id > 0) { if ($max_id > 0) {
$sql_extra = 'AND `item`.`id` <= ' . intval($max_id); $sql_extra = 'AND `thread`.`iid` <= ' . intval($max_id);
} }
$r = dba::p("SELECT " . item_fieldlists() . " $r = dba::p("SELECT " . item_fieldlists() . "
@ -1702,7 +1702,7 @@ function api_statuses_networkpublic_timeline($type)
AND `verb` = ? AND `verb` = ?
AND `item`.`id` > ? AND `item`.`id` > ?
$sql_extra $sql_extra
ORDER BY `thread`.`created` DESC ORDER BY `thread`.`iid` DESC
LIMIT " . intval($start) . ", " . intval($count), LIMIT " . intval($start) . ", " . intval($count),
ACTIVITY_POST, ACTIVITY_POST,
$since_id $since_id