]> git.wh0rd.org - tt-rss.git/commitdiff
purge_orphans: optimize the query, maybe
authorAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Wed, 15 Jul 2015 10:29:03 +0000 (13:29 +0300)
committerAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Wed, 15 Jul 2015 10:29:03 +0000 (13:29 +0300)
https://tt-rss.org/forum/viewtopic.php?f=1&t=3417&p=20408#p20407

include/functions.php

index 22179e1a4c74f59598fba6b753bef8573cc2ad7d..e5f2ca48667888bfec253690c651d70c4a74a0c9 100644 (file)
 
                // purge orphaned posts in main content table
                $result = db_query("DELETE FROM ttrss_entries WHERE
-                       (SELECT COUNT(int_id) FROM ttrss_user_entries WHERE ref_id = id) = 0");
+                       NOT EXISTS (SELECT ref_id FROM ttrss_user_entries WHERE ref_id = id)");
 
                if ($do_output) {
                        $rows = db_affected_rows($result);