Skip to content

Deleting large numbers of finished jobs #299

@gshaw

Description

@gshaw

We create 200-300K jobs a day and leave them in place for 7 days for analysis. We have a worker that then deletes the jobs finished older than 7 days. It all works but it can be slow and it can take longer than 60 seconds causing a Postgres statement to time out if we've a lot of extra load, e.g., 1M jobs needing to be deleted.

Even with an index on finished_at we've identified that the problem is that the que_state_notify procedure is doing a lot of work when deleting a large number of records.

I was wondering if others have had this problem and what they what others have done to solve this problem before I dive too deep into it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions