I was exploring how size in ML DB increases when we used XML data model and JSON data model. I found that the JSON files are taking more space than XML documents.
Below are the steps of this experiment -
- Select a XML document of your choice and create a JSON of the same XML.
- Create two fresh databases for each type of documents i.e. one DB will hold XML documents and another will hold JSON documents.
- Insert both files in corresponding databases and find the binary size of each using script mentioned in this https://developer.marklogic.com/recipe/document-size/ link.
- Then create a simple xquery to insert the JSON file multiple times with different uri in DB for JSON, create similar script for XML and insert in DB for XML.
I inserted 1 Million copies of each documents and found that the size of XML DB was 250 MB less than the JSON DB. One more thing the size of JSON document was ~13.3 KB and that of XML document was ~15.6 KB.
Despite the JSON file is smaller, but its 1M copies took 250 MB more.
Is MarkLogic saving the JSON natively? Why the size of JSON files to more space?