The term NoSQL, short for “not only SQL,” refers to non-relational databases that store data in a non-tabular format, rather than in rule-based, relational tables like relational databases do. NoSQL databases use a flexible schema model that supports a wide variety of unstructured data such as documents, key-value, wide columns, and graphs.
Organizations choose NoSQL databases for their flexibility, high performance, horizontal scalability, and ease of development.
Learn how Google Cloud’s NoSQL databases Bigtable, Memorystore, and Firestore can help you enhance your applications and provide great customer experiences without worrying about scalability, reliability, or frequent data changes.
There are five main types of NoSQL databases:
Document databases, also called document-oriented databases or a document store, are used to store and query semi-structured data. Data is stored in a JSON-like document similar to the data objects that developers use in application code, making it easier to create and update applications without referencing a primary schema. Document databases are most commonly used for blogging platforms, ecommerce, real-time analytics, and content management systems.
Key-value databases, also referred to as key-value stores, are the simplest type of NoSQL databases. Data is stored in a “key-value” structure, where a unique key is paired with a value such as a string, number, boolean, or complex objects. You can use the key to store or retrieve its associated value. Key-value stores are most commonly used for user preferences, shopping carts, and user profiles in web applications.
Column-oriented databases, or wide-column stores, store and read data in rows and are organized as a set of columns. While similar to the tabular format of relational databases, column names and formatting in wide-column stores can vary from row to row in a single table. They are optimal for analytics use cases, where you may need to query across specific columns in a database and aggregate the value of a given column quickly. Wide-column stores are most commonly used for catalogs, fraud detection, and recommendation engines.
Graph databases organize data as nodes in a graph, focusing on the relationships between data elements. The connections between nodes (edges) are stored as first-class elements, enabling richer representations of data relationships while offering more simplified storage and navigation. Graph databases are most commonly used in systems that map relationships, including social media platforms, reservation systems, fraud detection systems, and logistics applications.
In-memory databases store data in memory in order to provide ultra-low latency for real-time applications. Redis and Valkey are examples of in-memory NoSQL databases. In-memory databases are most commonly used for caching, messaging, streaming, and real-time analytics.
NoSQL features are unique to the database you choose. However, they typically share several similar high-level qualities:
These features make non-relational databases ideal for applications that require large scale, reliability, high availability, and frequent data changes.
Flexible data model and schema
NoSQL databases store many different types of data and offer flexible schemas, ideal for semi-structured and unstructured data. You can easily adapt them to new types of data and evolve the schema to meet any changing data requirements.
Agile development
The flexibility of NoSQL complements agile app development. A NoSQL database can store many types of data in its native format and allows the data model to be defined and adapted as you go, so developers can get going fast, spend less time on data transformation, and iterate quickly.
Scalability
Unlike relational databases, NoSQL databases make it easy to increase capacity as data and traffic grows—in most cases, with zero downtime. Cloud-based databases are even easier to scale on demand, offering autoscaling features and flexible pricing models.
Massive data storage
NoSQL is designed to handle large, complex datasets, allowing organizations to adopt them for big data, real-time analytics, and IoT use cases.
High availability
NoSQL data architectures are distributed by design and have no single point of failure. They also provide easy replication, making them more resistant to unplanned outages and disruptions.
Faster queries
Unlike relational databases, which are normalized to reduce data duplication, NoSQL is optimized for fast querying. It typically does not require complex joins, meaning that database queries return results more quickly.
While NoSQL databases have gained huge popularity in recent years, there are some drawbacks to using them over relational databases. They are still relatively new and may lack the maturity of relational databases. Overall, NoSQL comes with less developer expertise, fewer available tools and products, and less support should undocumented issues arise.
In addition, NoSQL has no lingua franca like SQL—each database may have its own language for querying and managing data. These languages are often similar but not fully compatible with the SQL standard.
In many cases, NoSQL databases lack the data integrity safeguards and high level of data consistency that are standard in SQL databases. However, there are some, like Firestore and MongoDB Atlas, that do support ACID transactions.
NoSQL databases usually aren’t a good choice for applications that run complex queries and joins. Managing indexes and queries across multiple nodes would be slow and may not return consistent results.
Still, eventual consistency models are sufficient for most NoSQL use cases, where a small millisecond delay doesn’t matter. For many applications, high availability and speed far outweighs the need for strong global consistency.
So why do organizations use non-relational NoSQL databases for some applications but stick with relational SQL databases for others? Picking the right database often comes down to your use case. Here’s when to use SQL vs NoSQL.
SQL databases excel in managing structured, relational data and complex queries. SQL databases are ACID-compliant, making them suitable for transactional information.
SQL use cases:
NoSQL databases excel in use cases that require large numbers of globally distributed users to deliver highly personalized experiences. These interactive applications are best served with the agility of NoSQL databases.
NoSQL databases prioritize high availability, deliver consistent performance, scale out quickly without downtime, and can handle large volumes of different types of data.
These features of NoSQL databases make non-relational databases ideal for applications that require large scale, reliability, and high availability.
The most common NoSQL uses include:
Start building on Google Cloud with $300 in free credits and 20+ always free products.