cancel
Showing results for 
Search instead for 
Did you mean: 

Best way to cleanup history?

rufini
Champ in-the-making
Champ in-the-making
Hi all;

I'm an Activiti newbie and I would like to know what could be the best way to cleanup history tables. I'm planning to write a SQL query to delete records from ACT_HI_* previous to certain date. Is that the best way? Any suggestion?

Thanks in advance!

rufini
5 REPLIES 5

jbarrez
Star Contributor
Star Contributor
Yes, that would be the easiest way to do it.

rufini
Champ in-the-making
Champ in-the-making
Thanks for your quick reply, jbarrez.

Is it sure to delete from that tables? Can I break something?

I'm thinking to do something like


DELETE FROM ACT_HI_ACTINST  WHERE END_TIME_ < '2011-06-22';
   
DELETE FROM ACT_HI_PROCINST WHERE END_TIME_ < '2011-06-22';

DELETE FROM ACT_HI_TASKINST WHERE END_TIME_ < '2011-06-22';

Thanks again,
rufini

jbarrez
Star Contributor
Star Contributor
Depends on what queries you have written. If you have any logic dependent on the history data, then it might break something 😉

But if not, then you can just delete the history data. If you are not using the history data, it might be good to set the history level to 'none'.

sharad
Champ in-the-making
Champ in-the-making
We have seen deleteHistoricProcessInstance and deleteHistoricTaskInstance api's avaliable for deleting process instances and task from history table. Do we still need to Delete SQL queries for History Cleanup ?

trademak
Star Contributor
Star Contributor
You can use these APIs as well, yes.