Description
I had the db_worker running all of yesterday but noticed today that it was orders of magnitudes slower than yesterday. I changed quite a lot of code so it was not clear right from the start, but eventually i got the idea of deleting all finished tasks.
And voila - it deleted about 230k entries and the db_worker was as fast as yesterday where i started.
Of course this will vary on the used DB (sqlite in my case).
But i would propose a setting like:
RESUL_TTL which could be a backend setting.
And while the prune_db_task_results manage.py command already exists it SHOULD BE NOTED in the docs that --min-age-days has a default of 14 days!
I was wondering why it refused to delete anything while the shell version found quite a lot of tasks after running a few minutes again:
DBTaskResult.objects.finished().delete()
Out[1]: (12958, {'django_tasks_database.DBTaskResult': 12958})
That said i wonder why those 230k of finished tasks were such a big deal for the db_worker as in general its not a large dataset. The sqlite DB is 120m in total. Those finished task should not affect the speed of the db_worker, but it did.