leftBlog

Key differences between MongoDB and MySQL

Key differences between MongoDB and MySQL

Brief Facts About MongoDB

  • Organizations that have to deal with BigData are increasingly using MongoDB. MongoDB is a good tool for working with unstructured data.
  • The NoSQL idea first appeared in 1998. Carlo Strozzi was the first to create a database management system that is characterized by the stream-operator paradigm for accessing data instead of the traditional SQL syntax. The stream-operator paradigm resembles a mathematical operation. However, NoSQL, such as MongoDB, still uses the RDBMS model.
  • MongoDB is one of the most popular NoSQL solutions. Its main goal is to simplify data storage. One of its outstanding features is a dynamic data storage scheme.
  • MongoDB data is presented in JSON (Java Script Object Notation) format. JSON allows you to transfer data between web applications and servers in a human-readable format. Before JSON, XML was used for this. In MongoDB, JSON is defined in BSON MongoDB (binary JSON). The BSON binary format provides reliability and greater efficiency when it comes to speed and memory consumption.
  • Customers who need a document-oriented database mostly use MongoDB. The most famous of them are Craigslist with over 2 billion entries in MongoDB, Shutterfly with over 18 billion photos, Foursquare, New York Times, Forbes and many others.


Brief Facts About MySQL

  • The first release of MySQL was in 1995 under the GNU GPL. It has gained popularity in the world of web applications thanks to the combination of LAMP and other stacks with the end of AMP. LAMP (Linux-Apache-MySQL-PHP) is a software stack that is used in many web applications.
  • Oracle is the current owner of MySQL.
  • The main disadvantage of SQL in the modern world is that today most of the data is unstructured data, which means that the traditional SQL table model is inefficient. According to Merryl Lynch, for 1998, between 80% and 90% of the data is unstructured.


The main differences between MongoDB and MySQL

  1. The difference in the presentation of data. In MongoDB, data is represented as collections of JSON documents, and in MySQL as rows and tables;
  2. The difference in database queries. SQL (Structured Query Language) is a special query language for interacting with SQL databases such as MySQL, PostgreSQL and others. In MongoDB, queries are object oriented.
  3. Queries on multiple tables. MySQL has a JOIN operation that allows you to query multiple data tables at once. MongoDB, although it does not have such a function, is equipped with multidimensional data types.
  4. Possibility of embedding. With MySQL, you can have one document inside another (embed). You will have to create one table for comments and another for posts if you use MySQL, for example, to create a blog. In MongoDB, you only need to create a collection of posts with a cell in the comments array.
  5. Binding to a data schema. In MongoDB, each collection object can contain different fields, while in MySQL all tables have a strongly typed schema.
  6. Performance. We will write here briefly - according to a number of studies, MongoDB has proved to be more productive. But it is worth noting that in the scale of the average application and with its correct construction, the difference in performance will be little noticeable.
#mysql#mongodb#разработка сложных ит продуктов#веб-разработка#база данных
Latest