summaryrefslogtreecommitdiff
path: root/functions.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2006-03-21 06:28:10 +0100
committerAndrew Dolgov <[email protected]>2006-03-21 06:28:10 +0100
commit30f1746fd58322386f9c78b060631eb95a0a37c2 (patch)
treed07c4dc77879cdecf817f993f848a0c195ce1b5b /functions.php
parent44e241cb44eb2c309b6def732d828368a7486824 (diff)
optimize purge for mysql
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/functions.php b/functions.php
index f0d6aa05e..f4450ada8 100644
--- a/functions.php
+++ b/functions.php
@@ -33,10 +33,18 @@
$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);
}