Can someone share database clean up queries for camunda. We need queries to
clear completed processes older than 30 days
clear failed jobs which are older than 30 days and failed jobs .
Atleast, please share the table names which we can use for the same.
I would strongly recommend to update to version 7.6, as the batch version is the easiest and fastest version to clean up your database. If this is not an option here are some hints that might help:
the tables that are probably interesting for you, are the ACT_HI_* tables (have a look at the dabase schema for more information)).
I just assume you are using the rest api:
first you can query for all historic process instances that were finished previous to 30 days ago. Have a look here and there especially the finishedBefore field might interest you.
With the given process instance ids you can now delete them manually (see here).
The deletion of the historic process instance will cause the deletion of respective historic activities, historic tasks and historic details (variable updates, form properties) as well.
OK got with history table but I found lots of questions which are still unanswered how to get clean up of ACT_GE_BYTEARRAY. In my case its almost 120GB.
Date date = Date.from(LocalDate.now().minusDays(30).atStartOfDay(ZoneId.systemDefault()).toInstant());
List<Deployment> list = repositoryService.createDeploymentQuery().deploymentBefore(date).list();
boolean cascade = true; // should delete till running process instance also ? true : false
for (Deployment deployment : list) {
repositoryService.deleteDeployment(deployment.getId(), cascade);
}