Аnalysis of methods for representing hierarchical information in document oriented databases
DOI:
https://doi.org/10.33216/1998-7927-2025-287-1-5-11Keywords:
document-oriented databases, MondoDB, hierarchical information, performance testing, Microsoft Azure, request unitsAbstract
The choice of an effective method for representing hierarchical information in databases is an important task in software system design since hierarchical data structures are widely used in various fields, including recommendation systems, supply chain management and analytical solutions. The article analyzes various methods of storing hierarchical structures in document-oriented databases using MongoDB as an example and compares their efficiency.
When working with a small amount of hierarchical data, almost any method will function at an acceptable speed. However, in cases where the system operates with hundreds or even thousands of hierarchies, an incorrect choice of representation method can significantly impact system performance, increase operational costs, and complicate data processing.
As part of the research, the authors analyzed methods for representing hierarchical structures in document-oriented databases, examined their advantages, disadvantages, and performance in real-world usage scenarios.
Document-oriented databases such as MongoDB provide flexible options for storing hierarchical data. In MongoDB, several approaches can be used: the adjacency matrix method, the materialized path method, and the nested sets method.
The article presents the results of performance testing of these methods in two scenarios: using a database installed on a dedicated server and using a cloud database service on Microsoft Azure. The choice of method depends on specific requirements for query speed, update flexibility, and implementation complexity.
The method of storingthe adjacency matrixperformed significantly better than in relational databases and can be used in many scenarios due to its simplicity of implementation. However, if frequent hierarchy queries or partial hierarchy retrievals are required in the software system, the materialized path method is recommended, as it operates much faster. Despite its higher implementation complexity and increased memory consumption, it provides better query performance. The nested sets method does not offer significant advantages for the most common use cases.
This research is useful for developers working on systems that process large volumes of hierarchical information.
References
1. Dionysius: A Framework for Modeling Hierarchical User Interactions in Recommender Systems / J. Wang, K. Kenthapadi, K. Rangadurai, D. Hardtke. // arXiv preprint, 2017. DOI: https://doi.org/10.48550/arXiv.1706.03849
2. Miller T. Hierarchical Operations and Supply Chain Planning. Springer London, London, 2001. DOI: http://dx.doi.org/10.1007/978-1-4471-0305-9
3. Дьомін М.К. Методи представлення ієрархічної інформації в реляційних базах даних інформаційно-управлінських архітектур. // Радіоелектроніка. Інформатика. Управління, Запоріжжя: ЗНТУ, 2007, №1(17). С. 56-62.
4. Danich V.N. Information-administrative architecture conception and principles of their modeling. / V.N. Danich, M.K. Domin// TEKA. Commision of motorization and energetics in agriculture. – Lublin University of Technology, Volodymyr Dahl East-Ukrainian National University in Lugansk, 2012. Vol. 12. No 4. P. 2330.
5. Benymol J. Performance analysis of NoSQL and relational data bases with MongoDB and MySQL./ J. Benymol, A. Sajimon // Materials-Today-ProceedingsVolume 24, Part 3, 2020, p. 2036-2043. DOI: https://doi.org/10.1016/j.matpr.2020.03.634
6. Model Tree Structures. [Електронний ресурс]. – Режим доступу: //https://www.mongodb.com/docs/manual/applications/data-models-tree-structures/
7. Celko J. A Lookat SQL Trees / JoeCelko // DBMS online [Electronic resource] / Miller Freeman, Inc– Electronicmag. [USA]: DBM Sand Internet Systems, 1996. March. DB [Електронний ресурс]. – Режим доступу: http://www.dbmsmag.com/9603d06.html, free. – Title from screen
8. Aggregation Pipeline. MongoDB Manual. [Електронний ресурс]. – Режим доступу: https://www.mongodb.com/docs/manual/core/aggregation-pipeline/
9. What is MongoDB Atlas? [Електронний ресурс]. – Режим доступу: https://www.mongodb.com/docs/atlas/
10. Request Unitsin Azure Cosmos DB [Електронний ресурс]. – Режим доступу: https://learn.microsoft.com/en-us/azure/cosmos-db/request-units?utm_source=chatgpt.com