1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-26 18:21:01 +00:00

feat(entry): keep only metadata for removed entries

This should significantly shrink the space taken by miniflux' database:

```sql
miniflux=#
SELECT
  relname, pg_size_pretty(pg_total_relation_size(relname::regclass))
FROM
  pg_catalog.pg_statio_user_tables
ORDER BY
  pg_total_relation_size(relname::regclass)
DESC;

       relname        | pg_size_pretty
----------------------+----------------
 entries              | 158 MB
 icons                | 3312 kB
 enclosures           | 1568 kB
 sessions             | 1048 kB
 feeds                | 288 kB
 feed_icons           | 72 kB
 users                | 64 kB
 user_sessions        | 64 kB
 categories           | 48 kB
 integrations         | 32 kB
 api_keys             | 32 kB
 webauthn_credentials | 24 kB
 schema_version       | 16 kB
 acme_cache           | 16 kB
(14 rows)

miniflux=#
```

This should close #3524
This commit is contained in:
jvoisin 2025-08-14 17:40:10 +02:00 committed by Frédéric Guillot
parent 9e722839b5
commit 5c26e06780
2 changed files with 49 additions and 3 deletions

View file

@ -46,4 +46,11 @@ func runCleanupTasks(store *storage.Storage) {
metric.ArchiveEntriesDuration.WithLabelValues(model.EntryStatusUnread).Observe(time.Since(startTime).Seconds())
}
}
if rowsAffected, err := store.DeleteContentRemovedEntries(); err != nil {
slog.Error("Unable to delete the content of removed entries", slog.Any("error", err))
} else {
slog.Info("Deleting content of removed entries completed",
slog.Int64("removed_entries_content_removed", rowsAffected))
}
}