How to delete data directly from mendix database based on an xpath

0
I have written a microflow, where i need to delete a number of records from database. I am retrieving the records in a list based on an xpath, and then use the delete activity to delete the list. But while analysis the trace logs, i noticed that mendix deletes these records one by one, based on their id. Due to these repeated delete statements, the database resources reach to the maximum, or sometimes crash, when there are high number of concurrent users. Is there any way out to write and execute a single delete query with required xpath, directly in the database? We have deployed our application on Mendix Cloud, so i dont think i can have the database connection to leverage the mendix external database connecter as well. I am using Mendix 10.12.11.
asked
1 answers
0

Ideally you should use batching to delete large sets of records. You can use offset and limit to retrieve a small chunk of records and delete them. This way resources are used in a optimized way. 

Additionally you can use Javaactions in CommunityCommons module "DeleteAll" or "DeleteAllWithoutEvents", pass a batch of objects and delete them.

You can find more details in the following question:

 

https://community.mendix.com/index3.html#/questions/11540474045338088

 

Regards,

Sharad R K

answered