Closed ribbons closed 4 years ago
After a prune and vacuum, my database was just over 300MB.
Running the above commands manually and then another prune and vacuum took it to 174MB.
Implemented roughly as originally described but made use of the foreign key constraints added since then to enable all of the cleanup to be performed from a single SQL statement.
Although the situation was greatly improved by #61, the application database (
store.db
) still grows in size over time.Analysing the contents of my own database, a lot of the data (images especially) appear to be for programmes which have had the list of available episodes viewed at some point but have never had any episodes downloaded. This isn't covered by the database
Prune
routine added as part of #61 as that only cleans up images for episodes marked as unavailable (which requires the available episodes list to be fetched regularly by repeated viewing or a subscription).To remedy this issue I propose adding the following additional cleanup commands to the
DatabaseInit.Prune
function:This first command deletes all episode information for programmes which:
Some of these are probably a bit redundant but I think it pays to err on the side of caution with this sort of cleanup.
This second command removes the programme entries themselves which have had their episodes deleted by the above.