# Performance Impact of Optimization Methods on MySQL Document-Based and Relational Databases
## 1 Introduction  
Nowadays, one of the most important aspects when building an application is the database where the data will be stored. As traditional relational databases could not handle these large volumes of data and process them instantly, there was a need for a different approach to data storage, namely, NoSQL (Not Only SQL (Structured Query Language)) databases. A NoSQL database is a non-relational database that does not store information in the traditional relational format. NoSQL is not built on tables and, in some cases, does not fully satisfy the properties of atomicity, consistency, isolation, and durability (ACID) [1]. A feature that is common to almost all NoSQL databases is that they handle individual items, identified by unique keys [2]. Additionally, structures are flexible, in the sense that schemas are often relaxed or free schemas. A classification based on different data models has been proposed [3], and it groups NoSQL databases into four major families:  
1. Key-value stores: based on a key-value model, where each record is characterized by a primary key and a collection of values;
2. Column-oriented: data are stored in columns, and each attribute of a table is stored in a separate file or region in the storage system;3. Document stores: data are stored in a document, and documents can be nested and thus contain other documents, lists, and arrays;
4. Graph stores: designed for data whose relations are well represented as a graph consisting of elements interconnected with a finite number of relations between them. From the several DBMSs that we have today, this paper focuses on two well-known alternatives for an application: a relational database (MySQL), and its non-relational alternative (document-based MySQL). The differences between the two are large, with MySQL being a relational database, structured in the form of tables containing columns, while document-based MySQL is a non-relational database, saving data as documents, using key-value pairs [4]. Document-based MySQL allows developers to work with SQL relational tables and schema-less JSON (Java Script Object Notation) collections [5]. To make that possible, MySQL has created the X DevAPI which places a strong focus on CRUD by providing a fluent API (application program interface) [6] allowing you to work with JSON documents in a natural way [7]. The X DevAPI uses a new protocol based on Google Protobuts [8] that provides features unable to be offered in the old protocol such as multiple non-blocking async queries and using MySQL as a NoSQL JSON Document Store with simple CRUD functions [9]. The X Protocol is highly extensible and is optimized for CRUD as well as SQL API operations. Moreover, document-based MySQL does not require defining a fixed structure during document creation and makes it significantly easier to change the record structure later [5,10]. Document-based MySQL offers users maximum flexibility in developing traditional SQL relational applications and NoSQL schema-free document database applications; this eliminates the need for a separate NoSQL document database [11]. Developers can mix and match relational data and JSON documents in the same database as well as the same application. Some of the document-based MySQL advantages are its high reliability, full consistency that provides multi-document transaction support, and full ACID (atomic, consistent, isolation, and durability) compliance for schema-less JSON documents. ACID properties define the key SQL database properties to ensure a consistent, safe, and robust database modification when saved [12]. One of the important criteria when choosing a database to use is its performance, in terms of the speed of data access and processing. When choosing the database, several aspects must be considered, including response times to the most important operations (insert, select, update, and delete), and its scalability, security, and flexibility, so that it can be changed easily and quickly without side effects.