A Comparison of SQL and Nosql Databases Design of Global Applications, IV1201

A Comparison of SQL and Nosql Databases Design of Global Applications, IV1201

A Comparison of SQL and NoSQL Databases Design of Global Applications, IV1201 2020-01-13 This is an attempt to compare relational databases, using the SQL query language, to NoSQL databases. NoSQL databases are briefly introduced, but the reader is assumed to already understand SQL databases. 1 What is NoSQL? NoSQL, or Not only SQL, refers to a database that does not model data using tabular relations, as is done in a relational database. This way of defining NoSQL by telling what it is not, naturally means there are quite big differences between different NoSQL databases. Generally, the data model is more relaxed than in a relational database. It is not required to adhere to a schema, but different records can have different format and contain different data. This can be visualized as a relational database where rows in the same table are not required to have the same columns. The most common example of NoSQL is perhaps document databases, for example MongoDB and Apache Cassandra, which use a document data model where each record is considered a document. Such a document can be for example a JSON object, which is a set of key-value pairs. Since there is no fixed schema, different documents (objects) can have different properties. Another type of NoSQL database is a key-value store, for example Redis or Mem- cached, where data is not grouped in documents, but simply stored as key-value pairs like in a hash table. A third type is a graph database, for example Neo4j, which could be explained as being a document database with relations between documents, where such relations are themselves documents. 1 (3) 2 A Comparison of SQL and NoSQL Here follows summaries of strong sides of both SQL and NoSQL. Lets first look at the strengths of a NoSQL database. A NoSQL database makes it easy to store unstructured data, since records are not required to follow a schema, instead each record just consists of its own data. Both reading and writing speed is improved by the fact that data is not nor- malized. An entire data record is written in one place A NoSQL database is more flexible than an SQL database, both in terms of data structure and query language. It is easy to scale a NoSQL database horizontally, that is by adding more nodes to the database cluster, since one data record is stored only in one place and not spread over multiple nodes. Table 1: Strengths of a NoSQL database The strengths of an SQL database, on the other hand, are as listed below. An SQL database is designed to preserve data integrity. All data records ad- here to the same well-defined schema, and normalization ensures there are no inconsistencies between records. It is more efficient to aggregate multiple data records in an SQL database be- cause data is well structured, and because the SQL language is mature and powerful. The entire query can be performed in SQL, while a NoSQL database normally requires processing the data in a program. This has an impact both on performance and on complexity of querying the database. All SQL databases use the same language, which has been in use for a very long time. This means it is easy to get advice, there are many tools and it is easy to query the database also for non-programmers. Data is always consistent and available, since SQL databases use ACID trans- actions. In a NoSQL database, data may be in a changing or inconsistent state. Table 2: Strengths of an SQL database 2 (3) 3 Combinations of SQL and NoSQL It is not always necessary to choose either SQL or NoSQL, since it is possible to combine them. For example MySQL has the MySQL Document Store, which allows combining SQL relational tables and schema-less JSON collections. Also, MongoDB can handle ACID transactions, and thus guarantee that data is always consistent. Another option is to use both a NoSQL and an SQL database for different parts of the same application. 4 Summary It is not possible to say that one alternative is better than the other, the issue is rather to find the best solution for the current situation. Generally, SQL databases are better suited for applications where all data must at all times adhere to the same schema, and for applications with complex queries. Examples could be financial systems or registers of staff, members, customers or something else. NoSQL databases, on the other hand, are better suited for applications with huge amounts of data that must not necessarily have a particular format, and applications with high performance requirements. Typical examples could be IoT applications with sensor data, social media, or mobile applications with many users. 3 (3).

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    3 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us