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.

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Learn MongoDB - MongoDB Tutorial for Beginners - Getting Started with MongoDB - Part 1/3

Learn MongoDB - MongoDB Tutorial for Beginners - Getting Started with MongoDB

Learn MongoDB - MongoDB Tutorial for Beginners - Getting Started with MongoDB - Part 2/3

Learn MongoDB - MongoDB Tutorial for Beginners - Getting Started with MongoDB

Learn MongoDB - MongoDB Tutorial for Beginners - Getting Started with MongoDB - Part 3/3

Learn MongoDB - MongoDB Tutorial for Beginners - Getting Started with MongoDB