Update - while digging deeper, I also stumbled upon this Save in batch not working - Support - Jmix. This might be the root cause.
My data model is large with many relations. It is really part of the business, not much we can do about that.
To improve performance for loading we have Fetching Data :: Jmix Documentation. For saving we have Using DataManager :: Jmix Documentation.
I need something similar for deleting large sets of entities. The current JmixDataRepositoryImpl.deleteAll() internally retrieve every entity one by one before deleting. My set has 27705 entities.
I tried multiple variants of deteAll() but they all internally use the same code.
The code that triggers the individual selects is the merge in JpaDataStore.deleteAll(SaveContext context)