I'am working on a project that use MySQL as RDBMS. Recently, we have to manipulate a big json data.

So, the first solution that comes in mind, and for many reasons, is to cooperate mongoDB with Mysql however it can add complications! (We use Symfony).

But from MySQL 5.7, MySQL supports native JSON data type which provides data JSON querying.

My question is : MySQL json data type can be the right choice instead of MongoDB document and therefore we don't need to use 2 DBMS?

  • 1
    Please, rephrase your question by replacing "better" with some measurable characteristics? Also, explain your use cases. It is impossible to tell if something is suitable or not without understanding the purpose of using it. – scriptin Jul 19 '17 at 23:10
  • JSON = string; MongoDB uses the BSON format to store the data and handles it very efficiently. If you have part of the data on you system that contains a flexible structure, I recommend not using a relational DB to store it, instead you could use a non-sql DB like MongoDB or another, it won't be a problem since you let the application control the persistence of these data. – Emerson Cardoso Aug 22 '17 at 16:40

MongoDB is not the only document database in existence (for example, ElasticSearch, RavenDB to name a couple off the top of my head). I would first consider what you need out of the JSON data.

  • Efficient searching?
  • Ad hoc queries?
  • Faceted searches?
  • Geospatial queries?
  • Histogram results?
  • Risk of data corruption or loss? (This used to be a serious problem with Mongo, but not sure if it still is)

When you examine what your actual needs are with that data you may choose something other than the two options you listed (MongoDB and MySQL/MariaDB). You need to know that your solution can handle the data needs now, and can scale in the future. You also need to understand how that scaling works.

That said, you can go with a short-term/long-term solution. For example: start with MySQL JSON data now since you already have that infrastructure, and start evaluating alternatives for the future. When your queries get too inefficient for MySQL, you should know very well the tool you want to use.


We're having a lot of JSON in company (hundreds of GBs) stored inside database... my suggestion would be to drop oracle mysql and use mariadb 10.2 as it has JSON support and also tokudb engine which has great compression (for storing JSON data). Innodb also has compression but ratio is low and compressed tables are slow...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.