Saga not closed and millions entries

Hello all,

We have millions of open sagas (around 17 million entries in association_value_entry) and my database size is about 900GB.
I need to close these sagas but want to avoid overloading the event bus by publishing a closing event for each saga.

Is it possible in Axon to close sagas programmatically without having to send an event through the event bus? What would be the best practice to handle large-scale saga cleanup without flooding the event system?

The application has been running in production for the past three years with a major development issue related to sagas: they were started but never properly closed.
This explains the growing database size and the large number of entries in the association_value_entry table.

That’s indeed a rather large amount of old sagas, Alexandre!

Since the association_value_entry table and saga_entry table are in your control, you are also free to simply delete some rows from them. When doing so, I would shut down the event processor for this saga for a bit, to ensure there are no other processes interacting with the saga tables.

Added, I would strongly recommend to have an “end-of-saga” process somewhere. Either though an event coming from one of the associated (aggregate) streams, or by adding a scheduled event or deadline to the saga to shut it down after a certain (business specific) time frame.