CODEX

MySQL vs NoSQL

Kasuni Madhushika
Nerd For Tech
Published in
7 min readFeb 27, 2021

--

Figure 1: MySQL-vs-NoSQL

MySQL

MySQL is a freely available open source Relational Database Management System(RDBMS) that uses Structured Query Language(SQL). SQL is the most powerful and popular language in database management. Using this language we can add, access and manage all the databases through it’s quick processing, reliability, ease and flexibility. Almost every open source PHP application use MySQL as their database management system.

MySQL development project has made its source code available under the terms of GNU license and proprietary agreements. Initially, its owned by a Swedish company called MySQL AB. But now owned by Oracle Corporation.

Figure 2: MySQL + PHP

MySQL Features

  • Easy to use : We can use only a few simple SQL statements to interact with MySQL.
  • Secure : Passwords are encrypted in MySQL. As well as, it consist of a solid data security layer tp protect the sensitive data from intruders.
  • Client/ Server Architecture : MySQL is a client/server system. There is a database server(MySQL) and arbitrarily many clients(application programs), which communicate with the server; that is, they query data, save changes and etc. The client can run on the same computer as the server or on another computer. All of the familiar large database systems like Oracle, Microsoft SQL Sever are client/server systems. These are in contrast to the file-server systems, which include Microsoft Access, dBase and FoxPro. The decisive drawback to file-server systems is that when run over a network, they become extremely inefficient as the number of users grows.
  • Free to download : Can download from MySQL official website freely.
  • Scalable : Supports multi-threading that makes it easily scalable. t can handle almost any amount of data, up to as much as 50 million rows or more. The default file size limit is about 4 GB. But we can increase this number to a theoretical limit of 8 TB of data.
  • Speed : MySQL is considered one of the very fast database languages, backed by a large number of the benchmark test.
  • High Flexibility : It supports a large number of embedded applications, which makes MySQL very flexible.
  • Compatible on many operating systems : Novell NetWare, Windows* Linux*, many varieties of UNIX* (such as Sun* Solaris*, AIX, and DEC* UNIX), OS/2, FreeBSD* are some examples for operating systems. As well as in here, client can run on the same computer as the server or on another computer. That means clients can communicate via a local network or the network.
  • Allows roll-back : This allows transactions to be rolled back, commit, and crash recovery.
  • Memory efficiency : Efficiency is high because of the low memory leakage problem.
  • High Performance : We can use Triggers, Stored procedures, functions, and views that allow the developer to give higher productivity.
  • Platform Independent : Can download, install, and execute on most of the available operating systems.
  • Partitioning : Improves the performance and provides fast management of the large database.
  • GUI Support : MySQL provides a unified visual database graphical user interface tool named “MySQL Workbench” to work with database architects, developers, and Database Administrators. MySQL Workbench provides SQL development, data modeling, data migration, and comprehensive administration tools for server configuration, user administration, backup, and many more.
  • Dual Password Support : MySQL version 8.0 provides support for dual passwords: one is the current password, and another is a secondary password, which allows us to transition to the new password.

Disadvantages of MySQL

  • MySQL lower versions like 5.0 or less versions doesn’t support ROLE, COMMIT and Stored procedure.
  • MySQL doesn’t support a very large database size as efficiently.
  • MySQL doesn’t handle transactions very efficiently, and it is prone to data corruption.
  • MySQL is accused that it doesn’t have a good developing and debugging tool compared to paid databases.
  • MySQL doesn’t support SQL check constraints.

NoSQL

Figure : 3

NoSQL stands for “not only SQL,” is an approach to database design that provides flexible schemas for the storage and retrieval of data beyond the traditional table structures found in relational databases. In here “No” in “NoSQL” is an abbreviation for “not only” and not the actual word “No”. NoSQL databases are recently become more popular in the era of cloud, big data and high-volume web and ease of use. However, NoSQL and relational databases are now commonly used together in a single application. There are most common types of NoSQL databases called key-value, document, column and graph databases.

A NoSQL database can manage information using any of four primary data models:

  1. Key-value databases : A simple type database where each item contains keys and values. In here, the key is usually a simple string of characters and the value is a series of uninterrupted bytes that are opaque to the database. As well as, the data is usually some primitive data type like String, Integer, array or a more complex object that an application needs to persist and access directly.
  • Key-value stores have no query language. They simply provide a way to store, retrieve, and update data using simple GET, PUT and DELETE commands. The simplicity of this model makes a key-value store fast, easy to use, scalable, portable, and flexible. So, this allows developer to easily modify fields and object structures as their application evolve.
  • Key-value databases are best for use cases to store large amount of data. But we don’t need to perform complex queries to retrieve it. Common use cases include storing user preferences or caching. Redis and DynanoDB are popular key-value databases.

2. Document databases : Stores data in documents similar to “JavaScript Object Notation” (JSON) objects. Each one contains pairs of fields and values. The value can be Strings, numbers, booleans, arrays, or objects and their structures typically align with objects developers are working with in code. As well as document databases are best for wide variety of use cases and can be used as a general purpose database because of the variety of field value types and powerful query languages. They can horizontally scale-out to accomodate large data volumes.

  • These are designed for flexibility. They aren’t typically forced to have a schema and are therefore easy to modify. Document databases are good option for the applications that requires the ability to store varying attributes along with the large amounts of data. MongoDB and Apache CouchDB are popular examples for this.

3. Wide-column stores : This is also called “column database”. This enables very quick data access using a row key, column name, and cell timestamp. column stores store data in tables, rows and dynamic columns. They provide a lot of flexibility than relational databases because each row is not required to have the same columns.

  • Wide-column stores are used for storing IOT(internet of things) data and user profile data. Apache Cassandra and HBase are popular examples for this.

4. Graph databases : This is a data storage and processing engine that make persistence and exploration of data and relationships more efficient. In here, each structure contains vertices and edges (data and connections). But now it called as “data relationships”. Nodes store data about people, places, and things and edges store data about the relationships between the nodes.

  • Graph databases are use for visualizing, analyzing, or helping you find connections between different pieces of data. Neo4j and JanusGraph are examples for Graph databases.

When to use NoSQL

  • To store large amounts of unstructured data with changing schemas.
  • When using cloud computing and storage.
  • For rapid developments.
  • When a hybrid data environment makes sense.

Comparison Between MySQL and NoSQL

Below figure represents the main differences between MySQL vs NoSQL.

Main differences between MySQL vs NoSQL databases.
Figure 4: Difference between MySQL vs NoSQL
  • MySQL is a relational database that is based on tabular design and NoSQL is a non-relational database with its document-based design.
  • MySQL is not so easily scalable with their rigid schema restrictions. But, NoSQL can be easily scaled with their dynamic schema nature.
  • MySQL needs a detailed database model before creating the database. But, no detailed modeling is required in the case of NoSQL database types.
  • MySQL is available with a wide array of reporting tools help application’s validity whereas NoSQL databases lack reporting tools for analysis and performance testing.
  • MySQL is less flexible and NoSQL is more flexible.
  • MySQL is being used with a standard query language called SQL. But, NoSQL doesn’t have any standard query language.
  • MySQL can provide a performance issue for huge amount of data. So, then require optimization of queries. But, NoSQL databases like MongoDB are good at performance even with the huge database.

Conclusion

Nowadays, NoSQL databases are becoming a major part of the industry. Because of its advantages like performance at a big data level, scalability, and flexibility of design, etc. Also, the other special things like lower cost and open source features are reasons for its success. As well as MySQL is also still covering a huge chunk of the market. MySQL database with its settled market encompasses a huge community than the NoSQL database. Therefore, upcoming problems can easily resolve.

References

https://www.educba.com/mysql-vs-nosql

--

--

Kasuni Madhushika
Nerd For Tech

Software Engineering Undergraduate at Sri Lanka Institute Of Information Technology