In this article we are going to talk about database migration strategies, why it should happen, how it should happen and what is the best option for each case.
Let’s imagine you started a startup with some friends some months ago, it’s a innovative that blow up in some months. At the start of the project you and your friends designed the database in a way expecting less users and not a lot of traffic, but now you see that the design is not really straight forward, and you would like to change the database, the design and some relationships too.
What do you do now? Should you redesign everything in this same SQL database? Or just go to another one? My answer is: Migrate!
Things to think about before migrating
First you have to think about the amount of data being transferred, if the quantity is not so high you can choose a migration strategy that is not very safe. Of course, the amount of data will rule if you can migrate with a simple JSON file or will need to use a exclusive tool just for this action. Think about the importance of the data in the database, is it really important in a way you can’t imagine losing this data?
If you are migrating to a database that is completely different from the one before, you have to think about fitting the data on the cloud/SQL/NoSQL of your choice, the bigger the data more work you’ll have to configure and set the data or the database the right way.
Think about how long will take this migration and configuration, do you need this migration quickly? You have someone to analyze the data after the migration? Will you migrate fewer data for it to be analyzed?
Migration strategies and what should you choose
The Different database migration strategies are:
- The big bang database migration
- Trickle database migration
- Zero-Downtime database migration
We will dive into each type.
The big bang database migration
It’s a single effort to migrate an entire database to another, it is a relatively simple process with a big downtime and a bigger chance of getting data corrupted or lost in the process, usually it’s done in the times when the server is not active among the users.
This strategy can be useful for small companies with simpler databases that are not active 24/7, this off-peak hours choice is mainly for being able to get less errors between this migration.
Trickle database migration
The trickle database migration is a slower way of migrating data from one server to another, but it's a more methodical and agile way of making a migration, making sub-migrations with scopes, deadlines and goals. Making it easier for the migration team to analyze each migration and confirm the success or data loss of each sub-migration. Of course, this migration requires more time and more resources because of both database running at the same time.
This is a strategy that can suit bigger projects or companies that have more time to migrate and more teams to analyze the migration to make sure the data won’t be lost.
Zero-Downtime database migration
It’s an approach to migrate your database without pausing the availability of the original database, making a migration with a small chunk of data and using a tool that will keep both databases in sync.
This is a great option for companies or projects that need faster migrations, even with bigger data and complex relations. It is a low-cost option with no needs to check if the processed data is corrupted or lost. It requires careful planning and testing for the migration to run perfectly without any error in the migration process.
With this article at OpenGenus, you must have the complete idea of Different database migration strategies.