Anda di halaman 1dari 6

 

What is NoSQL? 
Overview

Key-value
What is NoSQL?
Document
High-performance, nonrelational databases with flexible data
Graph
models

Get started with DynamoDB

What are NoSQL databases?


NoSQL databases are purpose built for specific data models and have flexible schemas for building
modern applications. NoSQL databases are widely recognized for their ease of development,
functionality, and performance at scale. They use a variety of data models, including document,
graph, key-value, in-memory, and search. This page includes resources to help you better
understand NoSQL databases and to get started.

For decades, the predominant data model that was used for application development was the
relational data model used by relational databases such as Oracle, DB2, SQL Server, MySQL, and
PostgreSQL. It wasn’t until the mid to late 2000s that other data models began to gain significant
adoption and usage. To differentiate and categorize these new classes of databases and data
models, the term “NoSQL” was coined. Often the term “NoSQL” is used interchangeably with
“nonrelational.”
What is NoSQL? 
Overview

Key-value
What's New for AWS Purpose-Built, Nonrelational Databases

Document

Graph

How Does a NoSQL (nonrelational) Database


Work?
NoSQL databases use a variety of data models for accessing and managing data, such as document,
graph, key-value, in-memory, and search. These types of databases are optimized specifically for
applications that require large data volume, low latency, and flexible data models, which are
achieved by relaxing some of the data consistency restrictions of other databases.

Consider the example of modeling the schema for a simple book database:

In a relational database, a book record is often dissembled (or “normalized”) and stored in
separate tables, and relationships are defined by primary and foreign key constraints. In this
example, the Books table has columns for ISBN, Book Title, and Edition Number, the Authors
table has columns for AuthorID and Author Name, and finally the Author-ISBN table has
columns for AuthorID and ISBN. The relational model is designed to enable the database to
enforce referential integrity between tables in the database, normalized to reduce the
redundancy, and generally optimized for storage.
In a NoSQL database, a book record is usually stored as a JSON document. For each book, the
item, ISBN, Book Title, Edition Number, Author Name, and AuthorID are stored as attributes in
a single document. In this model, data is optimized for intuitive development and horizontal
scalability.

Why should you use a NoSQL database?


NoSQL databases are a great fit for many modern applications such as mobile, web, and gaming
that require flexible, scalable, high-performance, and highly functional databases to provide great
user experiences.
Flexibility: NoSQL databases generally provide flexible schemas that enable faster and more
iterative development. The flexible data model makes NoSQL databases ideal for semi-structured
and unstructured data.
What is NoSQL? 
Scalability: NoSQL databases are generally designed to scale out by using distributed clusters of
hardware instead of scaling up by adding expensive and robust servers. Some cloud providers
Overview
handle these operations behind-the-scenes as a fully managed service.
Key-value
High-performance: NoSQL database are optimized for specific data models (such as document,
key-value, and graph) and access patterns that enable higher performance than trying to
Document
accomplish similar functionality with relational databases.
Graph
Highly functional: NoSQL databases provide highly functional APIs and data types that are
purpose built for each of their respective data models.

Types of NoSQL Databases

Key-value: Key-value databases are highly partitionable and allow horizontal scaling at scales that
other types of databases cannot achieve. Use cases such as gaming, ad tech, and IoT lend
themselves particularly well to the key-value data model. Amazon DynamoDB is designed to provide
consistent single-digit millisecond latency for any scale of workloads. This consistent performance is
a big part of why the Snapchat Stories feature, which includes Snapchat's largest storage write
workload, moved to DynamoDB.

Document: Some developers do not think of their data model in terms of demoralized rows and
columns. Typically, in the application tier, data is represented as a JSON document because it is
more intuitive for developers to think of their data model as a document. The popularity of
document databases has grown because developers can persist data in a database by using the
same document model format that they use in their application code. DynamoDB and MongoDB are
popular document databases that provide powerful and intuitive APIs for flexible and agile
development.

What is NoSQL? 
Overview

Key-value

Document

Graph: A graph database’s purpose is to make it easy to build and run applications that work with
Graph
highly connected datasets. Typical use cases for a graph database include social networking,
recommendation engines, fraud detection, and knowledge graphs. Amazon Neptune is a fully-
managed graph database service. Neptune supports both the Property Graph model and the
Resource Description Framework (RDF), providing the choice of two graph APIs: TinkerPop and
RDF/SPARQL. Popular graph databases include Neo4j and Giraph.

In-memory: Gaming and ad-tech applications have use cases such as leaderboards, session stores,
and real-time analytics that require microsecond response times and can have large spikes in traffic
coming at any time. Amazon ElastiCache offers Memcached and Redis, to serve low-latency, high-
throughput workloads, such as McDonald’s, that cannot be served with disk-based data stores.
Amazon DynamoDB Accelerator (DAX) is another example of a purpose-built data store. DAX makes
DynamoDB reads an order of magnitude faster.

Search: Many applications output logs to help developers troubleshoot issues. Amazon Elasticsearch
Service (Amazon ES) is purpose built for providing near-real-time visualizations and analytics of
machine-generated data by indexing, aggregating, and searching semistructured logs and metrics.
Amazon ES also is a powerful, high-performance search engine for full-text search use cases.
Expedia is using more than 150 Amazon ES domains, 30 TB of data, and 30 billion documents for a
variety of mission-critical use cases, ranging from operational monitoring and troubleshooting to
distributed application stack tracing and pricing optimization.
What is NoSQL? 
SQL (relational) vs. NoSQL (nonrelational)
Overview

databases
Key-value

Document
Though there are many types of NoSQL databases with varying features, the following table shows
some of the differences between SQL and NoSQL databases.
Graph

  Relational databases NoSQL databases

NoSQL key-value, document, graph, and


Relational databases are designed
in-memory databases are designed for
for transactional and strongly
OLTP for a number of data access
Optimal consistent online transaction
patterns that include low-latency
workloads processing (OLTP) applications and
applications. NoSQL search databases are
are good for online analytical
designed for analytics over semi-
processing (OLAP).
structured data. 

The relational model normalizes


data into tables that are composed
of rows and columns. A schema
strictly defines the tables, rows, NoSQL databases provide a variety of
Data model columns, indexes, relationships data models that includes document,
between tables, and other database graph, key-value, in-memory, and search.
elements. The database enforces the
referential integrity in relationships
between tables. 

ACID NoSQL databases often make tradeoffs by


Relational databases provide
properties relaxing some of the ACID properties of
atomicity, consistency, isolation, and
relational databases for a more flexible
durability (ACID) properties:
data model that can scale horizontally.

Atomicity requires a This makes NoSQL databases an excellent


transaction to execute choice for high throughput, low-latency

completely or not at all. use cases that need to scale horizontally


Consistency requires that beyond the limitations of a single

when a transaction has been instance.


committed, the data must
conform to the database
schema.
Isolation requires that
concurrent transactions
execute separately from each
other.
Durability requires the ability
What is NoSQL?  to recover from an unexpected
system failure or power
Overview outage to the last known
state.
Key-value

Document Performance is generally dependent


on the disk subsystem. The Performance is generally a function of the
Graph
Performance optimization of queries, indexes, and underlying hardware cluster size, network
table structure is often required to latency, and the calling application.
achieve peak performance.

NoSQL databases typically are


Relational databases typically scale
partitionable because key-value access
up by increasing the compute
patterns are able to scale out by using
Scale capabilities of the hardware or scale-
distributed architecture to increase
out by adding replicas for read-only
throughput that provides consistent
workloads.
performance at near boundless scale.

Requests to store and retrieve data Object-based APIs allow app developers
are communicated using queries that to easily store and retrieve in-memory
conform to a structured query data structures. Partition keys let apps
APIs
language (SQL). These queries are look up key-value pairs, column sets, or
parsed and executed by the semistructured documents that contain
relational database. serialized app objects and attributes.

SQL vs. NoSQL Terminology


The following table compares terminology used by select NoSQL databases with terminology used
by SQL databases.

SQL MongoDB DynamoDB Cassandra  Couchbase

Data
Table Collection Table Table
bucket

Row Document Item Row Document

Column Field Attribute Column Field

Primary key ObjectId Primary key Primary key Document