From 8458a312aecb64d651c28a14ea4a0f50cf1a58ec Mon Sep 17 00:00:00 2001 From: tmo-github Date: Thu, 27 Nov 2014 20:04:24 +0100 Subject: [PATCH] Modify query to avoid a full table scan on MySQL --- include/functions2.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/functions2.php b/include/functions2.php index 866c92ec..29594076 100644 --- a/include/functions2.php +++ b/include/functions2.php @@ -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"); -- 2.39.5