I'm busy creating a simple DBTester program with a Data Access Layer that can Test and Compare multiple (kind of) Databases. Currently I have implemented the Add(Insert) for SQL Server and MarkLogic NoSQL.
To my supprise inserting/adding 1 M Person Entities takes much more time using MarkLogic XCC/.Net XQuery than using SQL Server 2008 R2. SQL Server takes a few minutes of which 11 seconds in 11654 ms in Data Access Layer. MarkLogic 8 is still busy at 15621 entities in 15+ minutes!
I'm new to NoSQL MarkLogic and XCC/XQuery and maybe doing something wrong. My test code for MarkLogic can be found at GitHub: https://github.com/driekus77/DBTester/blob/master/DBTester/DataAccessLayer/Repository/MarkLogic/PersonRepository.cs#L48
The corresponding SQLServer Add code can be found at: https://github.com/driekus77/DBTester/blob/master/DBTester/DataAccessLayer/Repository/SQLServer/PersonRepository.cs#L64
So what am I doing wrong? Should I use MarkLogic RestAPI direct? Should I use JSON in stead off XML? Are there ways to speed up my XQuery Add call?
Thanks for any help!
See my original comment. IN addition, I also note that you are inserting items into a single 'persons' CML document. That is not what MarkLogic prefers. Each person is meant to be a separate record. Otherwise, - because it is a transactional database, each of your insert-child calls is blocking as it is the same document.