Table scheduler_run_details keeps growing and 'Purge Old Job Run Details' seems not to clean it

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

    

Summary

Per official Scheduled Jobs documentation, the Purge Old Job Run Details job is out-of-the-box configured to remove successful jobs which ran more than 90 days ago and unsuccessful jobs which ran more than 7 days ago.

However, the scheduler_run_details table is very big with millions of rows, including insert and update operations, and your DBA would like to reduce its size. 

Diagnosis

There is no way to tune how many events are stored in the scheduler_run_details table. 

When using Confluence DataCenter, there are regular processes that need to run very frequently to ensure the integrity of the data since queries and updates could come from anywhere in the cluster. Scheduled operations, like Cluster Safety, are very simple to run; there is no real penalty for running it many times per hour, other than disk space taken up by the scheduler_run_details table.

Since this table does not have a lot of indexes and triggers associated with it, letting it grow large shouldn't be a drag on the database.

Solution

The initial approach is to purge more aggressively this table, by overriding the system properties shown below.

For example, you can set to keep the last 30 days of successful jobs, the last 24 hours of unsuccessful ones and limit the purge to 500.000 rows per purge.

-Djobs.limit.per.purge=500000
-Dall.jobs.ttl.hours=720
-Dunsuccessful.jobs.ttl.hours=24

 Adjust these settings as you think they are more convenient for your environment and business needs


Alternatively, it is also possible to reduce the size of scheduler_run_details table manipulating directly the database.

Delete till a specific point in time
  1. Stop Confluence
  2. Set the threshold, for example 7 days, and run the following DELETE statement:

    DELETE FROM scheduler_run_details WHERE start_time < '2023-03-24 00:00:00'
  3. Start Confluence.

    After the restart, you might observe some strange date in the scheduled jobs page, it will be cleaned up by Confluence after the first round of job execution.

Reset the complete table
  1. Stop Confluence
  2. Same approach as before, but running the following TRUNCATE statement:

    TRUNCATE TABLE scheduler_run_details;
  3. Start Confluence

    With this approach, all job execution history will be purged. So if you do not feel comfortable, let's stick to the first approach deleting the data till a specific point in time




Last modified on Jun 28, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.