diff options
author | GregThib <[email protected]> | 2015-07-13 12:03:50 +0200 |
---|---|---|
committer | GregThib <[email protected]> | 2015-07-13 12:03:50 +0200 |
commit | c2916856541ed82b2f11b5f3ff29b1e4f5cd6b3e (patch) | |
tree | 71029a3639d3454497c28df39fcaefb568fa7e37 /include/functions.php | |
parent | f45b67c53e3db1f567c8038be8451218ed18ee85 (diff) |
Performance breakthrough
Improvement in the Purge method for huge performance increase.
"WHERE ref_id IS NOT NULL" is needed by pgsql, not necessarily by mysql.
This is a more standard way to make deletions based on propagation (from ttrss_user_entries) with 1-to-N relations.
Diffstat (limited to 'include/functions.php')
-rw-r--r-- | include/functions.php | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/include/functions.php b/include/functions.php index 22179e1a4..a57c09478 100644 --- a/include/functions.php +++ b/include/functions.php @@ -320,8 +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"); - + id NOT IN (SELECT ref_id FROM ttrss_user_entries WHERE ref_id IS NOT NULL)"); if ($do_output) { $rows = db_affected_rows($result); _debug("Purged $rows orphaned posts."); |