]> git.wh0rd.org Git - tt-rss.git/commitdiff
optimize purge for mysql
authorAndrew Dolgov <fox@madoka.spb.ru>
Tue, 21 Mar 2006 05:28:10 +0000 (06:28 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Tue, 21 Mar 2006 05:28:10 +0000 (06:28 +0100)
functions.php

index f0d6aa05e60f862bb61b4828507aaca6e432a918..f4450ada8c7ec475473e5510550a207402a66d89 100644 (file)
                        $rows = pg_affected_rows($result);
                        
                } else {
-                       $result = db_query($link, "DELETE FROM ttrss_user_entries WHERE
+/*                     $result = db_query($link, "DELETE FROM ttrss_user_entries WHERE
                                marked = false AND feed_id = '$feed_id' AND
                                (SELECT date_entered FROM ttrss_entries WHERE 
-                                       id = ref_id) < DATE_SUB(NOW(), INTERVAL $purge_interval DAY)");
+                                       id = ref_id) < DATE_SUB(NOW(), INTERVAL $purge_interval DAY)"); */
+
+                       $result = db_query($link, "DELETE FROM ttrss_user_entries 
+                               USING ttrss_user_entries, ttrss_entries 
+                               WHERE ttrss_entries.id = ref_id AND 
+                               marked = false AND 
+                               feed_id = '$feed_id' AND 
+                               ttrss_entries.date_entered < DATE_SUB(NOW(), INTERVAL $purge_interval DAY)");
+                                       
                        $rows = mysql_affected_rows($link);
 
                }