diff options
| author | tmo-github <github@yuit.net> | 2014-11-27 20:04:24 +0100 |
|---|---|---|
| committer | tmo-github <github@yuit.net> | 2014-11-27 20:04:24 +0100 |
| commit | 8458a312aecb64d651c28a14ea4a0f50cf1a58ec (patch) | |
| tree | 3e13ba8f51de4252e26a01ba20bfec01e075305b /include | |
| parent | 2c30a62e77688da34b7ce30832524e3a61af3508 (diff) | |
Modify query to avoid a full table scan on MySQL
Diffstat (limited to 'include')
| -rw-r--r-- | include/functions2.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/functions2.php b/include/functions2.php index 866c92ec9..29594076c 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"); |