Hello ! I'm using Prefect with PostgreSQL and some...
# ask-community
a
Hello ! I'm using Prefect with PostgreSQL and some of the tables are becoming quite huge (like
log
). I was wondering why deleting a Flow Run (using the API) doesn't delete the associated entries in the
log
table? ⬇️
I ran this query to discover that:
Copy code
SELECT
    *
FROM
    log l
WHERE
    NOT EXISTS (
        SELECT
            *
        FROM
            task_run tr
        WHERE
            tr.id = l.task_run_id
    );
g
Is there a set of Export/Clean-Up scripts that Prefect can share on how to prune old flow runs and there related tables?
s
Hi there, we have a github issue around resolving that, so it may be a good idea to add any additional thoughts there: https://github.com/PrefectHQ/prefect/issues/10000
a
Hello @Serina! Is it something that I can do to help about this? I have to admit that having this PR merged could be very helpful to help maintenance
s
That’s actually an issue not a PR 😞 We generally take contributors though
a
Oh my bad, I didn't paid attention.
g
@Serina I see this issue has not been prioritized, does prefect have any documentation on self-hosted recommended clean up tasks. I have noticed that when you delete a flow_run it does clean up some of the other tables. I would love to know which ones are and are not cleaned up so we could write a script archive and purge our db
s
Hi Gregory, I don’t think that we do. Feel free to create an issue for it :)