My production database is getting big and I want to remove all data in the act_hi_actinst to save space.I did some test and I think it’s oké to do this.
The only thing that will no longer work are there api calls:
history/historic-activity-instances
query/historic-activity-instances
Am I right? Or do you see other complications? Some other thing in the runtime I did’t take into account? Anyone has any experience with this?
Yes you can remove all data in the act_hi_actinst table. The only thing you lose is reporting or auditing data for processes instances that have ended. But it doesn’t have any impact on running process instances in the Engine.
Hi Yannick,
also as a side note, this might save some possible frustration in the future: depending on the database you are using, deleting rows might not recover all data from disk. For example, it’s wise to rebuild indexes / analyze tables / compute statistics (depending on DB vendor) after having deleted a very large number of rows from a table. Only then will you have regained the maximum disk space and query performance.
A TRUNCATE of a table really deletes everything and gives back your space, and is the fastest (but I guess you would still want to keep the most X recent months of history data, so that’s not what you want)
We were planning on a truncate on that table… Since I haven’t used this table/data in three years.
On the index topic: I have a bunch in cronjobs that delete historic processes (mostly helper processes with little or no business value). After a while I get index tables that are bigger then the original tables… which make my rest queries superslow. What we do now (which is not fun let alone clean) is turn of webservice, do an export of the database, do an import again and restart the service. This rebuilds the indexes on our database (Postgres) and buys me a few months of quicker searches and less disk used. You have a different solution?
Hi Yannick,
just rebuilding the indexes should be enough to solve the problem you are describing. In Oracle that’s the REBUILD INDEX command ; in Postgres it seems to be REINDEX. So "REINDEX DATABASE " should do the trick for all indexes at once. You should turn of your webservice probably, because the tables will require a lock when doing this.And while you are at it, you might just do a VACUUM FULL as well.
The ‘bloated’ index’ problem you are having, is described more in detail here : https://www.postgresql.org/docs/9.6/static/routine-reindex.html
hope that helps.
Pieter