Modify query to avoid a full table scan on MySQL

This commit is contained in:
tmo-github 2014-11-27 20:04:24 +01:00
parent 2c30a62e77
commit 8458a312ae
1 changed files with 2 additions and 2 deletions

View File

@ -1975,8 +1975,8 @@
}
function getLastArticleId() {
$result = db_query("SELECT MAX(ref_id) AS id FROM ttrss_user_entries
WHERE owner_uid = " . $_SESSION["uid"]);
$result = db_query("SELECT ref_id AS id FROM ttrss_user_entries
WHERE owner_uid = " . $_SESSION["uid"] . " ORDER BY ref_id DESC LIMIT 1");
if (db_num_rows($result) == 1) {
return db_fetch_result($result, 0, "id");