Databases: Switching from relational to document models, Part 3
Reading Time: 4 minutes

This is a three-part blog series. Part one is located here, and part two can be found here.

Migration to Document-Oriented Databases

There are various reasons why companies decide to migrate to document-oriented databases. One of the primary reasons is to achieve better performance and scalability to handle large database sizes. In new environments with several terabytes of data, it may be more efficient to move to a web-ready database. Additionally, the ability to provide high availability and minimize downtime is crucial, and document-oriented databases are designed to offer these features.

Using a flexible schema can also be advantageous for e-commerce, web applications, or any other application that requires scaling out. By adding more nodes, the performance can be improved, and replication and sharding features can be utilized.

However, before migrating, it is important  to ensure that the workload is compatible with the features that document-oriented databases offer. Not all applications will perform better on a document-oriented database, and it is essential to take advantage of the appropriate features for the migration to be successful. Migrating from a relational database can be complex and time-consuming, particularly if denormalization is involved. If the application is legacy or existing, the entire data layer may need to be rewritten since document-oriented databases do not use SQL.

It is also important to note that not all document-oriented databases offer features such as triggers and stored procedures. Therefore, check if the application relies heavily on these features before migrating. However, document-oriented databases share many similarities with relational databases, and primary keys and secondary indexes can still be used.

Most document-oriented databases are NoSQL and asset-compliant, and they offer various security features, such as roles and granular access to different collections, TLS/SSL, and more. It is important to monitor and maintain the database regularly, checking for poorly performing queries and creating alerts and backups.

In summary, migrating to a document-oriented database can be beneficial, but it requires careful consideration and planning to ensure a successful transition.

Best Practices and Common Mistakes of Migration

Here’s a summary of the best practices and common mistakes when migrating or developing applications using document-oriented databases.

Best Practices:

– Keep the document as simple and consistent as possible, and make it human-readable for developers and maintainers;

– Organize tables or collections per subject;

– Avoid joints as much as possible;

– Use embedded documents wisely and avoid duplicating entire data;

– Pay attention to indexes and query performance.

Common Mistakes:

– It’s okay to use both NoSQL and SQL databases in the same application;

– Do not try to simplify the import of your relational data into a document-oriented database;

– Not enforcing any pattern (schema) will make data retrieval complex: keep the name and properties of documents consistent to make querying easier;

– Be aware of the language and functions of your chosen NoSQL database. NoSQL languages are not standardized. 

By following these best practices and avoiding common mistakes, developers can ensure a successful migration or application development using document-oriented databases.

This is a three-part blog series. Part one is located here, and part two can be found here.

0 Comments

About the author

blank

Adamo Tonete

MongoDB SME

With decade of experience in NoSQL Databases, Adamo have worked for different companies such as Percona, MongoDB and PingCAP. Currently Adamo works as a MongoDB SME for an Irish company, maintening a 24×7 system.

Related posts

Subscribe to Updates

Privacy Policy