Merge branch 'improve-update_feedbrowser_cache-sql-query' into 'master'

Improve update_feedbrowser_cache SQL query

As explained in <https://tt-rss.org/forum/viewtopic.php?t=4060&p=23768>, this change improved drastically the query time.

See merge request !48
This commit is contained in:
Andrew Dolgov 2017-02-16 15:07:41 +03:00
commit 3102a1b338
1 changed files with 2 additions and 3 deletions

View File

@ -23,9 +23,8 @@
function update_feedbrowser_cache() {
$result = db_query("SELECT feed_url, site_url, title, COUNT(id) AS subscribers
FROM ttrss_feeds WHERE (SELECT COUNT(id) = 0 FROM ttrss_feeds AS tf
WHERE tf.feed_url = ttrss_feeds.feed_url
AND (private IS true OR auth_login != '' OR auth_pass != '' OR feed_url LIKE '%:%@%/%'))
FROM ttrss_feeds WHERE feed_url NOT IN (SELECT feed_url FROM ttrss_feeds
WHERE private IS true OR auth_login != '' OR auth_pass != '' OR feed_url LIKE '%:%@%/%')
GROUP BY feed_url, site_url, title ORDER BY subscribers DESC LIMIT 1000");
db_query("BEGIN");