Understanding NewSQL Databases – 了解新数据库

最后修改: 2023年 12月 12日

中文/混合/英文(键盘快捷键:t)

1. Overview

1.概述

Databases are one of the ways we store collections of data and there are different types of databases available. Different DBMSs, such as SQL and NoSQL databases, became popular based on the requirements (performance, consistency, etc.) and the type of data (structured, schemaless, etc.) to be stored. We now have something called NewSQL Databases which combine the best of both SQL and NoSQL databases.

数据库是我们存储数据集合的方式之一,有不同类型的数据库可供选择。不同的 DBMS,如SQL 和 NoSQL 数据库,根据要求(性能、一致性等)和要存储的数据类型(结构化、无模式等)而变得流行起来。现在,我们有了一种被称为 NewSQL 数据库的东西,它结合了 SQL 和 NoSQL 数据库的优点。

In this tutorial, we’ll take a look at SQL and NoSQL databases and then understand what NewSQL databases are all about.

在本教程中,我们将介绍 SQL 和 NoSQL 数据库,然后了解 NewSQL 数据库是怎么回事。

2. SQL and NoSQL Databases

2.SQL 和 NoSQL 数据库

For decades, traditional SQL databases have served as the foundation of data storage and retrieval. SQL Databases provide robust ACID compliance, guaranteeing dependability, consistency, and data integrity. Some of the popular use cases include OLTP and OLAP applications and Data Warehousing applications.

几十年来,传统的 SQL 数据库一直是数据存储和检索的基础。SQL 数据库提供了强大的ACID合规性,保证了可靠性、一致性和数据完整性。一些流行的使用案例包括OLTP 和 OLAP 应用程序和数据仓库应用程序。

On the other hand, database requirements changed along with the digital landscape. With the rise of the internet came an abundance of data, as multiple sources produced huge amounts of data instantly. Despite their consistency and dependability, traditional SQL databases found it difficult to handle the demands of these fast-moving data streams.

另一方面,数据库的要求也随着数字环境的变化而变化。互联网的兴起带来了大量数据,因为多个数据源会即时产生海量数据。传统的 SQL 数据库尽管具有一致性和可靠性,却难以应对这些快速移动数据流的需求。

As a result, NoSQL databases emerged as viable alternatives. NoSQL databases put performance, scalability, and flexibility above ACID compliance. They use several data models (document, key-value, column-family, etc.) that enable them to perform well in particular use cases, including networked systems, real-time analytics, and unstructured data storage. Social media applications and document-oriented applications are some of the most common use cases.

因此,NoSQL 数据库成为可行的替代方案。NoSQL数据库将性能、可扩展性和灵活性置于ACID合规性之上。它们使用多种数据模型(文档、键值、列族等),这些数据模型使它们能够在特定用例(包括网络系统、实时分析和非结构化数据存储)中发挥出色的性能。社交媒体应用程序和面向文档的应用程序是一些最常见的使用案例。

While NoSQL databases offered a solution to the scalability problem, they came with trade-offs, most notably relaxed consistency models. In scenarios where strong data consistency and transactional guarantees were essential, NoSQL databases fell short. This led to the need for a new kind of database system which could have the best of both, SQL and NoSQL.

尽管 NoSQL 数据库为可扩展性问题提供了一种解决方案,但它们也有取舍,最明显的是放宽了一致性模型。在需要强大数据一致性和事务保证的场景中,NoSQL 数据库无法满足要求。因此,我们需要一种新型数据库系统,它能同时兼顾 SQL 和 NoSQL 的优点。

3. NewSQL Database

3.NewSQL 数据库

NewSQL databases try to address the limitations of the existing databases. They’re engineered as a relational database with a distributed and fault-tolerant architecture. They aim to provide solutions by providing a database with the following features:

新数据库试图解决现有数据库的局限性。它们被设计为具有分布式容错架构的关系数据库。它们旨在通过提供具有以下功能的数据库来提供解决方案:

  • Scalability and ACID compliance: Designed to scale horizontally, the NewSQL databases handle large amounts of data by distributing them across nodes/clusters. Additionally, they maintain strict ACID compliance resulting in a system that is highly available and with strong transactional integrity.
  • Performance optimization: Various techniques, such as in-memory processing, indexing, and caching, are implemented to provide low-latency data access and high performance.
  • Distributed architecture: Multiple nodes are used to replicate data so that there is no single point of failure. Consequently, it ensures high availability and fault tolerance
  • SQL compatibility: NewSQL systems are compatible with SQL query language thus avoiding re-learning and migration overheads

3.1. Use-Cases

3.1.用例

NewSQL databases are most suited for applications requiring strong transactional consistency along with high performance and scalability. Let’s take a look at some of the use cases below:

NewSQL 数据库最适合需要强大事务一致性以及高性能和可扩展性的应用。让我们来看看下面的一些使用案例:

  • Financial systems: A large amount of data needs to be processed with low latency and high accuracy
  • E-commerce platforms: Although the load is relatively stable and expected, periodically there may be a surge of data/load that needs to be supported
  • Real-time feedback systems: Many systems that rely on real-time data analysis like airline pricing, fraud detection, etc. can benefit from a high-performant transactional system.
  • Smart devices and cities: With increased automation across multiple sectors and use cases, the continuous data stream can be processed efficiently using a NewSQL database.

However, there are some use cases where the NewSQL database may not be suitable:

但是,有些使用案例可能不适合使用 NewSQL 数据库

  • Well-established data models: Applications with well-established data models with manageable load and/or scalability capabilities may not be suitable candidates for migration to NewSQL databases, e.g., legacy applications
  • Predictable loads: Applications with predictable loads that may not need to leverage dynamic scalability
  • Strict ACID compliance: SQL databases better serve applications with non-negotiable ACID properties

Let’s take a look at some of the popular NewSQL databases:

让我们来看看一些流行的 NewSQL 数据库:

  • CockroachDB: An open-source distributed database designed to survive different types of failures while still maintaining ACID compliance. It uses distributed architecture and provides strong failover capabilities along with automatic data replication.
  • NuoDB: It uses a patented “elastically scalable databases” architecture to provide NoSQL benefits while retaining ACID compliance.
  • VoltDB: An in-memory database that uses a shared-nothing architecture designed for high-velocity data ingestion.

3.3. Drawbacks

3.3.缺点

While NewSQL databases address the limitations of SQL and NoSQL databases, they come with their own set of drawbacks:

虽然 NewSQL 数据库解决了 SQL 和 NoSQL 数据库的局限性,但它们也有自己的一系列缺点:

  • Use case specific: Different NewSQL databases are suitable for different use cases and there is no single solution for all use cases
  • Complex learning curve: Since NewSQL databases tend to be use case specific, each new implementation may require a non-overlapping learning curve
  • Compatibility issues: NewSQL databases may not be always compatible with existing data models and schemas which may lead to considerable migration efforts

4. Conclusion

4.结论

In this article, we explored the evolution of data storage and retrieval from traditional SQL to NoSQL databases and then finally to NewSQL databases. We also looked at the different use cases for NewSQL databases as well as some of the popular NewSQL databases.

在本文中,我们探讨了数据存储和检索从传统 SQL 到 NoSQL 数据库再到 NewSQL 数据库的演变过程。我们还研究了 NewSQL 数据库的不同用例以及一些流行的 NewSQL 数据库。

NewSQL databases bridge the gap between SQL and NoSQL databases by combining transactional consistency with scalability and performance. We saw some of the use cases where it may be beneficial to use any of the enumerated NewSQL databases.

NewSQL数据库通过将事务一致性与可扩展性和性能相结合,在SQL和NoSQL数据库之间架起了一座桥梁。我们看到了一些使用案例,在这些案例中,使用任何列举的NewSQL数据库都可能是有益的。