Purge doesn't clean up all relevant tables

I am running TT-RSS since a long time. I finally decided I wanted to clean up the database as its getting rather large.
The purge functionality is too broad for me, as I only want to delete entries from certain categories (junk). Hence I wanted to delete manually via SQL and had to look into the code how deletion/purging is handled there.

The purge_feed function in functions.php seems to be the only place that is taking care of deleting feed entries. Unfortunately it only deletes entries from ttrss_user_entries and ttrss_entries (see functions.php, line 272 / 256).

Looking through the database I can also see the following tables:

  • ttrss_enclosures
  • ttrss_archived_feeds

I’m not sure about ttrss_archived_feeds, but ttrss_enclosures definitely has a link to post_id (hence the entries table). ttrss_enclosures is never cleaned up anywhere. Shouldn’t it be cleaned up as well?

I also couldn’t find any cleanup job cleaning up ttrss_archived_feeds, I suppose the rule is that if no entry exists anymore for archived_feed with the ID = 1, it should also delete the archived_feed entry, shouldn’t it?

From https://git.tt-rss.org/git/tt-rss/src/c30f5e18119d1935e8fe6d422053b127e8f4f1b3/schema/ttrss_schema_pgsql.sql#L278 :

post_id integer references ttrss_entries(id) ON DELETE cascade NOT NULL);

Didn’t look at cascades. Thanks for the heads up!

Full deletion SQL:
DELETE ttrss_user_entries, ttrss_entries FROM ttrss_entries
INNER JOIN ttrss_user_entries
ON ttrss_entries.id = ttrss_user_entries.ref_id
INNER JOIN ttrss_feeds
ON ttrss_user_entries.feed_id = ttrss_feeds.id
INNER JOIN ttrss_feed_categories
ON ttrss_feeds.cat_id = ttrss_feed_categories.id
WHERE ttrss_user_entries.marked = false
#Add the category id that should be deleted from (SELECT id, title FROM ttrss_feed_categories)
AND ttrss_feed_categories.title = ‘News’
#Everything before this date will be deleted
AND ttrss_entries.date_updated < ‘2013-04-08 11:17:37’

Archived feeds remain undeleted though, don’t they?

we have multiple threads on both this and old forums on the subject of purging + wiki pages

maybe go read those before asking to be spoonfed here?

good luck with your hoarding i guess

@fox as charming and friendly as ever…

I wasn’t trying to be spoonfed, I thought I found a genuine bug/improvement. Of course I searched before, but after looking through a couple of posts didn’t find what I’m looking for. I guess I didn’t find a bug.

Also hoarding sounds very negative… I use the archive in TT very often to find old tidbits of information and am very happy with it.

why is it always purging that confuses some people, despite the numerous threads and a literal faq entry

because you didn’t. and neither did all the people before you. unfortunately that didn’t stop them (nor you) from posting.

at some point answering same questions over and over gets, you know, tiring.