How to decide which data to put in NoSQL and which data to SQL if we have both databases?

Coder Singh
2 min readJun 13, 2021

With increase in data in databases a lot of the companies started adopting NoSQL. But is SQL the best solution? Obviously, not. There are few things in which SQL is far better than NoSQL so some midsize companies to big companies have different databases for different kinds of data.

But how we decide to add data in NoSQL or SQL?

A database of e-commerce can be in MySQL and MongoDB. Now what all tables or collections to put in MongoDB or MySQL. I like to divide the data in 2 categories:

  • Vertical data
  • Horizontal data

Vertical data

Is kind of data which is too much than any other data in other tables like booking of products on e-commerce. Booking table has high probability it will be more than any other table. So, we will add this kind of data to MongoDB which can scale easily.

But I’m Booking Table what about the relation(join) with product info and user info?

We can denormalise the data and save it.

Horizontal data

It is kind of data which is very connected with each other. Like Product in e-commerce. Product has vendor, category and subcategories. A product is related to too many other fields it means the product table has horizontal data. For this kind of data I will add it in MySQL.

If you have doubts, want career advice, want help with assignment, help at job or anything related to tech.

Connect with me on a video/audio call:

15 mins(Free): https://bit.ly/3rNsoYA

15 mins($7): https://bit.ly/3rJ45Ls

30 mins($49): https://bit.ly/3xgBle4

60 mins($79): https://bit.ly/3zXMwKq

Instagram: https://bit.ly/2V9mgyf

Youtube Channel: https://bit.ly/3zYCzMS

--

--

Coder Singh

I am a YouTuber and a blogger who loves technology.