# Is there a way to clean up processes in MySql?

**URL:** <https://forum.flowable.org/t/is-there-a-way-to-clean-up-processes-in-mysql/10312>\
**Category:** Flowable Engine\
**Created:** [March 8, 2023, 1:24am UTC](https://forum.flowable.org/t/is-there-a-way-to-clean-up-processes-in-mysql/10312 "2023-03-08T01:24:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mazorks](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@mazorks](https://forum.flowable.org/u/mazorks)\
**Post date:** [March 8, 2023, 1:24am UTC](https://forum.flowable.org/t/is-there-a-way-to-clean-up-processes-in-mysql/10312/1 "2023-03-08T01:24:05Z")

</div>

Hello!

we use flowable with Spring boot, for a flaw in our design, we have plenty of old processes that will never make it to a end Event.

We see a constant increase of resources in our mysql, can these processes be responsible of that increase because they get stored somewhere and never deleted? is there a way to clean / delete those processes?

we have started around 10M processes, around 15% of them will never reach and end event.

Thank you!

---

<div class="post-metadata">

**Author:** ![gdharley](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/gdharley/32/2695_2.png) [@gdharley](https://forum.flowable.org/u/gdharley)\
**Post date:** [March 8, 2023, 5:53pm UTC](https://forum.flowable.org/t/is-there-a-way-to-clean-up-processes-in-mysql/10312/2 "2023-03-08T17:53:50Z")

</div>

Likely you have two sources of “bloat”.  
All process instances populate two different sets of tables.

1. Runtime tables - hold the status of currently running processes.
2. History tables - hold the status of all running AND closed processes.

If you don’t have an archive/truncate strategy then history tables will grow forever.  
You can manage history table truncation automatically using the “Housekeeping” feature of Flowable:

> **[History · Flowable Open Source Documentation](https://www.flowable.com/open-source/docs/bpmn/ch11-History/#history-cleaning)**
>
> History is the component that captures what happened during process execution and stores it permanently. In contrast to the runtime data, the history data will remain present in the DB also after process instances have completed.

As for running instances that are never completed, these will remain in the runtime tables until such time as they are completed and can be removed.

If you are able to identify these instance via a query (i.e. process definition id, deployment id or similar) then you can write a simple class to close these instances out and then let your archive strategy deal with them.

Hope this helps,  
Greg

---

<div class="post-metadata">

**Author:** ![mazorks](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@mazorks](https://forum.flowable.org/u/mazorks)\
**Post date:** [March 9, 2023, 2:53pm UTC](https://forum.flowable.org/t/is-there-a-way-to-clean-up-processes-in-mysql/10312/3 "2023-03-09T14:53:07Z")

</div>

Thank you so much Greg! We will start removing the history tables and I think we have a way to search all the uncompleted instances, I think the best way is to follow what you say and force those instances to an end event.

Thank you!
