Which database should I use, MongoDB or MySQL?

Which database should I use, MongoDB or MySQL?

If the question is between using a&nbsp;<a href="https://en.wikipedia.org/wiki/Document-oriented_database" target="_blank">Document</a>&nbsp;database versus a&nbsp;<a href="https://en.wikipedia.org/wiki/Relational_model" target="_blank">Relational</a>database, it ultimately boils down to a few simple questions about your data.

If the question is between using a Document database versus a Relationaldatabase, it ultimately boils down to a few simple questions about your data.

  • Do you have data that has a small number of searchable keys, but otherwise you anticipate little or no requirements to search your data by arbitrary criteria?
  • How structured is your data? Is your data basically tabular - would it fit nicely in spreadsheet-style rows and columns - or is it more like somewhat similarly-formatted files that can be expressed using JSONformat?
  • Do you have a lot of relationships between data elements, and do these relationships change often? Referential integrity.
  • Do you need to make sure that data and relationships between data become visible “all at once”? This requirement is very common in financial data, but is also common in many other applications. Support for ACID transactions and multi-statement transactions enables this requirement.
  • Can you afford to lose some currently-processed data and relationships between data if your database crashes? This is also a feature of database transactions and crash recovery.
  • What type of skillsets do most of your developers have?

Even if you have a requirement that some data is tabular and other data is more “file-structured”, you can still use something like MySQL or PostgreSQL, as they both support JSON documents of the sort you’d store in MongoDB as well as more traditional row-and-column data of the sort you’d have in a relational database: MySQL JSON supportPostgreSQL JSON support.

My own opinion is that the “default” go-to datastore in most situations is a relational database, unless you have a whole lot of data that is amenable to being stored in JSON documents as well as being looked up by a relatively small number of fixed criteria. By “a whole lot of data”, I mean enough that you need a large number of modern machines to handle it.

We have about 20 terabytes of “payload” (non-replicated) data in my current work environment, and we use MySQL on multiple machines to manage it. (With replicants it probably goes up to about 80TB or so.) The data is basically tabular data.

mongodb

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

MongoDB Database and java applications

Enroll for free demo to acquire the best knowledge on the schema-less database from live industry experts through MongoDB training

Which is the Best MongoDB GUI?

Our MongoDB Online Training provide you to learn about MongoDB strategies with realty. Our MongoDB Online Training also includes live sessions, live Projects, and much

Improve the MongoDB Aggregation Framework

Our MongoDB Online Training provide you to learn about MongoDB strategies with realty. Our MongoDB Online Training also includes live sessions, live Projects, and much

MongoDB – Database, Collection, and Document

Our MongoDB Online Training provide you to learn about MongoDB strategies with realty. Our MongoDB Online Training also includes live sessions, live Projects, and much

MongoDB brings database product range under one cloudy roof

Enroll for free demo to acquire the best knowledge on the schema-less database from live industry experts through MongoDB training