![]() On the other hand, if your database has large documents with constant updates and you want good performance on writes, then you may want to consider normalization. On one hand, if you have a database that doesn’t need regular updates, has small documents that grow slowly in size, immediate consistency on the update is not very important, but you need a good performance on reads, then denormalization may be the smart choice. This way of storing data will also take up more space.īefore you choose between the two ways of storing data, asses on the way you will use the database. It will perform better on reads but will be slower on writes. ![]() If you want to receive data from multiple collections, you have to perform multiple queries making the reads slower.ĭenormalization - this is storing multiple data embedded in a single document. When it comes to reading tasks, normalization has its downsides. The data is defined once, making the writing tasks (update) easy. Normalization - normalizing means storing data into multiple collections with references between them. These two define the way MongoDB stores the data. Given the fact that MongoDB works with documents, it’s very important to understand the concepts of normalization and denormalization. The diagram below explains the structure compared to an RDBMS:ĭatabase Design Tips and Tricks Smart Document Management: Normalization vs Denormalization It stores data in collections, documents, and fields. ![]() Unlike a traditional RDBMS, MongoDB doesn’t work with tables, rows, and columns. Before getting to some design tips, we have to first understand how MongoDB structures the data. To get the best out of MongoDB, you have to understand and follow some basic database design principles.
0 Comments
Leave a Reply. |