Optimizing Data Grid using Microflow instead of XPath with OR operator as a Data Source - Mendix Forum

Optimizing Data Grid using Microflow instead of XPath with OR operator as a Data Source

0

Hello everyone,
I just want to share with you how important it’s to follow Mendix best practices where the better option is to use Microflow as a data source instead of using XPath with the OR operator.

We had an issue where the Documents tab is taking too long to load. Locally is almost the same, a bit faster, but also takes some time. First thought was that there are a lot of documents in the DB, which is also the case, we decided to delete them all just to test it, we deleted more than 580 000 rows/documents in the DB and after that loading was right away. Great result, but in that case there are no documents :D So with a proof of best practices for (non)using or operator in the XPath I optimized the loading.

In the screenshot below is the current setting, CandidateDocuments are retrieved by XPath, which contain OR operator and also an association.

 

Locally it takes 4-10 seconds, just to open tab Documents, and in the case where is more documents, to look them in the all pages 1-20,21-40 and 41-53  it took more than 16 second.

 



The solution I found is actually to use the MF as the Data Source to optimize the OR by fetching separately into the two actions and then join them with an union.

Which results with 18ms to retrieve (locally).



So tests above are locally, but the improvement is obviously. With the current setting on PROD it takes approx 55 sec, those changes are still not on PROD, but I believe it will reduce time to max 1sec.

asked
2 answers

Hi Teoh,

well I’m not 100% sure, but I think when writing more complex XPaths they have larger queries and because of that they are slower. 

 

Created

Hi,

 

I’ve also faced performance issue. According to your solution, I would required use 1)intersect then 2)union then 3)intersect then 4)sort then 5)head, seems a little too much activity than writing xpath.

Why is this happening? I don’t understand.

Do you suggest me to use xpath or the stated activity flow.

Created