Max. amount for retrieve at once

2
Hi, I have 1,6 Mio. objects I want to retrieve and delete. 1,600,000 at the same time where to much for Mendix, so I used a While-loop and limited the amount to 100,000.  What max amount for a retrieve, that Mendix can handle? Is there a best practice?
asked
6 answers
1

In the CommunityCommons module is a DeleteAll java action which removes all items in a table and deletes those in Batches. Maybe you better use this if you must delete all items.

answered
1

Hi Tjark,

Mendix recommends that you not pull more than 3’000 objects into memory. Unfortunately, I can not point you at this moment where exactly I read that.

If you are aggregating values, then a retrieve + aggregate function will only pull the aggregate value into memory and not the entire list (ONLY if that retrieve is not used within the same microflow again!)

Hope that helps!

answered
1

In this case, it would be a better option to retrieve in a batch of 2000-3000 objects and the delete them. Instead of ‘All’ use ‘Custom’ retrieve

 

 

See this for more information https://docs.mendix.com/refguide/retrieve#3-3-2-range

answered
0

Thx for your input!

answered
0

The Java action turned out as very slow for 1,600,000 instances. Is there a better and faster way do handle data amounts like this?

answered
0

You could use the executeWithConnection API to directly run a SQL query against the database:

https://apidocs.rnd.mendix.com/9/runtime/com/mendix/datastorage/DataStorage.html#executeWithConnection(com.mendix.systemwideinterfaces.core.IContext,java.util.function.Function) 

Be careful with this API! It allows any SQL statement to be executed.

answered