Hi! I've been running a prefect server instance (v...
# ask-community
v
Hi! I've been running a prefect server instance (version 0.14.11) in production for a few months, running a dozen flows, some of them every minute. The UI is getting extremely slow when clicking on a flow run or task run. Is this known to happen ? Should I delete old flow and task runs to limit the size of flow_runs and task_runs tables ? If yes, what's the best way to do it ? Thanks in advance !
I just checked in the database how many rows there are in both tables:
Copy code
prefect_server=# SELECT COUNT(*) FROM flow_run;
 count  
--------
 169607
(1 row)

prefect_server=# SELECT COUNT(*) FROM task_run;
  count  
---------
 1501563
(1 row)
That's a lot but should not really be a problem with indexes.. any idea why it's getting so slow ?
k
Hey @Vincent Chéry, maybe the database is just getting slow? Yes this is known to happen, server users regularly truncate the
task_run
table and the
logs
table.
v
Thanks Kevin
I started deleting archived versions of my flows, I'm guessing that will the cascade delete task_run and logs tables as well ?
Do you have a recommendation for how to automate this ? Like how to truncate everything that's older than one month ?
k
No I don’t believe it will cascade, you can delete based on time though (older than a month), and it should all be aligned
v
Is there any way to do this through the python or grpahql APIs ?
k
The API no. If Python, manually through connecting to postgres. This thread might help you.
v
Perfect, thanks 😉
👍 1