Saturday 9 November 2013

No SQL vs SQL

Types


SQL      : One type (SQL database) with minor variations

No SQL : Many different types including key-value stores, document databases, wide-column stores, and graph databases

Development History

SQL      : Developed in 1970s to deal with first wave of data storage applications

No SQL : Developed in 2000s to deal with limitations of SQL databases, particularly concerning scale, replication and unstructured data storage

Examples

SQL      : MySQL, Postgres, Oracle Database

No SQL : MongoDB, Cassandra, HBase, Neo4j

Data Storage Model

SQL      : Individual records are stored as rows in tables, with each column storing a specific piece of data about that record

No SQL : Varies based on database type. For example, key-value stores function similarly to SQL databases, but have only two columns ("key" and "value"), with more complex information sometimes stored within the "value" columns. Document databases do away with the table-and-row model altogether, storing all relevant data together in single "document" in JSON, XML, or another format, which can nest values hierarchically.

Schemas

SQL : Vertically, meaning a single server must be made increasingly powerful in order to deal with increased demand.

No SQL : Horizontally,The database automatically spreads data across servers as necessary

Development Model

SQL : Mix of open-source (e.g., Postgres, MySQL) and closed source (e.g., Oracle Database)

No SQL :  Open-source

Supports Transactions

SQL : Yes, updates can be configured to complete entirely or not at all

No SQL :  In certain circumstances and at certain levels (e.g., document level vs. database level)

Data Manipulation

SQL : Specific language using Select, Insert, and Update statements, e.g. SELECT fields FROM table WHERE…

No SQL : Through object-oriented APIs

Consistency
SQL : Can be configured for strong consistency

No SQL : Depends on product. Some provide strong consistency (e.g., MongoDB) whereas others offer eventual consistency (e.g., Cassandra)

No SQL

No SQL
  • A NoSQL database provides a mechanism for storage and retrieval of data that employs less constrained consistency models than traditional relational databases. 
  •  NoSQL databases are finding significant and growing industry use in big data and real-time web applications.
  •   NoSQL systems are also referred to as "Not only SQL" to emphasize that they may in fact allow SQL-like query languages to be used.

NoSQL encompasses a wide variety of different database technologies and were developed in response to a rise in the volume of data stored about users, objects and products, the frequency in which this data is accessed, and performance and processing needs. Relational databases, on the other hand, were not designed to cope with the scale and agility challenges that face modern applications, nor were they built to take advantage of the cheap storage and processing power available today. 

The Benefits of NoSQL

When compared to relational databases, NoSQL databases are more scalable and provide superior performance, and their data model addresses several issues that the relational model is not designed to address:
  • Large volumes of structured, semi-structured, and unstructured data
  • Agile sprints, quick iteration, and frequent code pushes
  • Object-oriented programming that is easy to use and flexible
  • Efficient, scale-out architecture instead of expensive, monolithic architecture

NoSQL Database Types

  • Document databases pair each key with a complex data structure known as a document. Documents can contain many different key-value pairs, or key-array pairs, or even nested documents.
  • Graph stores are used to store information about networks, such as social connections. Graph stores include Neo4J and HyperGraphDB.
  • Key-value stores are the simplest NoSQL databases. Every single item in the database is stored as an attribute name (or "key"), together with its value. Examples of key-value stores are Riak and Voldemort. Some key-value stores, such as Redis, allow each value to have a type, such as "integer", which adds functionality.
  • Wide-column stores such as Cassandra and HBase are optimized for queries over large datasets, and store columns of data together, instead of rows.