History tables still grow after deleting finished process instances

Hi,

for purging the history I use the REST API method: DELETE /history/process-instance/{id} for all finished process instances. But, after deleting action, I have observed that history tables are still growing. It seems that this action did not clean up any data in the tables. How is it possible? Could I manually delete the history tables using TRUNCATE table ACI_HI* sql statement?

Is the size of the database still growing or are the records actually still in the table? In the former case, it’s likely you need to perform a vacuum on the database after the deletions. That will free up the space for the database itself.

In general, the history tables were designed so you could safely truncate the data in there. Note that this will affect your ability to search the history with some APIs, because the data is gone. It will also remove the history of running processes, which might break some functionality if you rely on it. One example is when you lookup whether a task has had multiple executions before the current one. Without the history, you can’t determine that. So If you perform mass deletions, the best option is to start with finished instances only, as you were already doing.

the size of tables are still growing in bytes, but for deleted instances it is not possible to retrieve data. So, my conclusion is that data are removed from tables but it seems that it is not true.

In that case, I would look into a vacuuming of the database.

ok, I will try that. Thanks a lot

1 Like

Hi,
I have asked DBA and he told me that Oracle database cannot reclaim unused space (vacuum). It seems that REST API method: DELETE /history/process-instance/{id} did not actually deleted the records, but managed them in some other way. I have deleted 70+ thousands instances, but database is still allocating new space. How is it possible? I am using Camunda 7.12 version.

Normally, that should remove the records, I’d think. So you may have encountered a bug. Were the API calls successful?

yes, the delete action was successful. I used REST API method: DELETE /history/process-instance/{id} where id is processInstanceId. Also, when clean up task was finished I used GET /history/process-instance//{id} to check whether everything is ok. All instances was deleted, but DBA said that database is still allocating new space (Oracle).

Okay, so if the calls worked, the records were purged and the database is not freeing up space, then I fear it’s up to you and the DBA. There may be others in the community that have experienced this with Oracle specifically. Hope you can find a solution!