https://prefect.io logo
Title
s

Sam Cook

08/03/2021, 3:48 PM
Is there a utility, graphql mutation, or canned SQL query available for cleaning up the postgres database? I have a kubernetes deployment and I want to regularly clean up some of the larger tables (logs, task runs) while leaving recent data from the past 30 days intact so users don't suddenly lose all of their recent logs, tasks, etc.
k

Kevin Kho

08/03/2021, 4:05 PM
Hey @Sam Cook, Prefect doesn’t have anything like this unfortunately. It’s just deleting the records greater than 30 days like what you are suggesting. Yes logs, task runs are the bigger tables that should be deleted.
s

Sam Cook

08/03/2021, 4:27 PM
@Kevin Kho Are you saying that Prefect already cleans up old logs or that the pattern is to just delete the tables?
k

Kevin Kho

08/03/2021, 4:28 PM
I mean the pattern is just to delete those entries yep. Prefect doesn’t delete anything in general (logs, results, etc). Some users also accumulate a lot of disk space usage with Results so deleting those would be good too.