From: Hypolite Petovan Date: Sun, 17 Dec 2017 15:06:12 +0000 (-0500) Subject: Improve networkpublic_timeline SQL performance X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=cdd5bd5615718094fba948e3d7d80a7082737be4;p=friendica.git Improve networkpublic_timeline SQL performance - Use thread.iid for max_id and ordering --- diff --git a/include/api.php b/include/api.php index bedac23ac4..b06629ff64 100644 --- a/include/api.php +++ b/include/api.php @@ -1691,7 +1691,7 @@ function api_statuses_networkpublic_timeline($type) $sql_extra = ''; 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() . " @@ -1702,7 +1702,7 @@ function api_statuses_networkpublic_timeline($type) AND `verb` = ? AND `item`.`id` > ? $sql_extra - ORDER BY `thread`.`created` DESC + ORDER BY `thread`.`iid` DESC LIMIT " . intval($start) . ", " . intval($count), ACTIVITY_POST, $since_id