From: Andrew Dolgov Date: Wed, 15 Jul 2015 10:29:03 +0000 (+0300) Subject: purge_orphans: optimize the query, maybe X-Git-Tag: 16.3~217 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=7680d44ef21d3a8eec3e564516b348e0feb87e28;p=tt-rss.git purge_orphans: optimize the query, maybe https://tt-rss.org/forum/viewtopic.php?f=1&t=3417&p=20408#p20407 --- diff --git a/include/functions.php b/include/functions.php index 22179e1a..e5f2ca48 100644 --- a/include/functions.php +++ b/include/functions.php @@ -320,7 +320,7 @@ // 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);