Camunda db clean up sql queries


#1

HI Team,

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.

Thanks,
Amol


#2

HI @Amol23,

would a batch operation be an option for you?

Cheers,
Askar.


#3

Hi Askar,

This is for version 7.6 however I am using 7.4.

Regards,
Amol


#4

Hi @Amol23,

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.

Best,
Johannes


#5

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.


#6

Hi @Amol23,

I’ve recently updated this snippet: https://github.com/camunda/camunda-consulting/tree/master/snippets/clean-up-history

Maybe this helps you to find the relevant relations.

Cheers, Ingo