Crate 是关系数据库吗?

Is Crate a relational DB?

起初我以为它不是关系数据库,但在我读到我可以连接表并且它写在他们的网站上后 https://crate.io/overview/(请参阅用例),我不确定.

特别是我被句子弄糊涂了:

CrateDB is based on a NoSQL architecture, but features standard SQL.

来自 https://crate.io/overview/high-level-architecture/

CrateDB 是一个分布式 SQL 数据库。底层技术类似于所谓的 NoSQL 数据库通常使用的技术(无共享架构、列式索引、最终一致性、对半结构化记录的支持)——但可以通过传统的 SQL接口.

因此 - 是的,CrateDB 有点像 关系型 SQL 数据库 .

自从关系模型开始以来,系统必须被视为关系的三个主要组件是(将 Codd 的 "data model" 的三组件定义应用于关系模型):

  • 数据呈现为关系 (tables)
  • 操纵是通过关系 and/or 逻辑 operators/expressions
  • 完整性由关系 and/or 逻辑 operators/expressions
  • 强制执行

此外,多用户 DMBS 已被理解为支持明显的原子持久事务,同时受益于通过重叠执行 (ACID) 的实施,分布式 DBMS 已被理解为支持明显的单一数据库,同时受益于在多个站点的实施.

根据这些标准,CrateDB 不是关系型的。

它有tables,但它对tables的操作极其有限,而且几乎没有完整性功能。重新操作,它允许查询满足条件(包括聚合)的 table 的行,并且它允许连接多个 table,但这并没有优化,即使是 equijoin。 Re约束,它唯一的功能是列类型、主键和非空列。它使用 SQL.

小子集

查看您的 link 回复 Supported Features and Standard SQL Compliance 的页面,地址如下:

Crate SQL
    Data Definition
        Constraints (PRIMARY KEY Constraint, NOT NULL Constraint)
        Indices
    Data Manipulation
    Querying Crate
        Retrieving Data (FROM Clause, Joins)
    Joins
    Crate SQL Syntax Reference

与非关系 DBMS 一样,它们的文档并不反映对关系模型或其他基本 DBMS 功能的理解或欣赏。

根据 Codd's 12 rules(已用于识别关系数据库),CrateDB 不是关系数据库 - 。 CrateDB 的最终一致性模型并不禁止。

Rule 0: For any system that is advertised as, or claimed to be, a relational data base management system, that system must be able to manage data bases entirely through its relational capabilities.

CrateDB 没有可以插入、检索和更新数据的另一个接口。

Rule 1: All information in a relational data base is represented explicitly at the logical level and in exactly one way — by values in tables.

正是在 CrateDB 中可以找到的内容。

Rule 2: Each and every datum (atomic value) in a relational data base is guaranteed to be logically accessible by resorting to a combination of table name, primary key value and column name.

这是严格执行的。通过主键访问甚至会给你写后读的一致性。

Rule 3: Null values (distinct from the empty character string or a string of blank characters and distinct from zero or any other number) are supported in fully relational DBMS for representing missing information and inapplicable information in a systematic way, independent of data type.

CrateDB 支持 null。

Rule 4: The data base description is represented at the logical level in the same way as ordinary data, so that authorized users can apply the same relational language to its interrogation as they apply to the regular data.

CrateDB 有其他元表,Information Schema tables

Rule 5: A relational system may support several languages and various modes of terminal use (for example, the fill-in-the-blanks mode). However, there must be at least one language whose statements are expressible, per some well-defined syntax, as character strings and that is comprehensive in supporting all of the following items:

  • Data definition.
  • View definition.
  • Data manipulation (interactive and by program).
  • Integrity constraints.
  • Authorization.
  • Transaction boundaries (begin, commit and rollback).

CrateDB 支持数据定义和数据操作部分,并且只支持一个完整性约束(主键)。这绝对是不完整的。

Rule 6: All views that are theoretically updatable are also updatable by the system.

CrateDB 还不支持视图。

Rule 7: The capability of handling a base relation or a derived relation as a single operand applies not only to the retrieval of data but also to the insertion, update and deletion of data.

CrateDB 目前只做数据检索...

Rule 8: Application programs and terminal activities remain logically unimpared whenever any changes are made in either storage representations or access methods.

CrateDB 对 SQL 的使用允许这样做; performance/storage 等级提升甚至可以通过系统升级实现。

Rule 9: Application programs and terminal activites remain logically unimpared when information-preserving changes of any kind that theoretically permit unimpairment are made to the base tables.

部分内容仍然缺失(视图,inserts/updates 连接)。但是对于检索数据,已经是这样了。

Rule 10: Integrity constraints specific to a particular relational data base must be definable in the relational data sublanguage and storable in the catalog, not in the application programs.

这对于分布式数据库来说非常棘手,特别是外键约束。 CrateDB 目前只支持主键约束

Rule 11: A relational DBMS has distribution independence.

在 CrateDB 中,任何类型的 sharding/partitioning/distribution 都对用户透明处理。任何类型的数据分布constraints/settings都应用于数据定义级别。

Rule 12: If a relational system has a low-level (single-record-at-a-time) language, that low level cannot be used to subvert or bypass the integrity rules and constraints expressed in the higher level relational language (multiple-records-at-a-time).

有人可能会争辩说 COPY FROM 直接违反了这条规则,因为底层没有类型检查和转换发生。但是,没有其他 command/language/API 允许以其他方式进行数据操作。

虽然 CrateDB 当然还有一些工作要做,但从这个意义上说,它没有理由不会很快成为一个关系数据库。它的 SQL support 可能无法与 Oracle 或 Postgres 相提并论,但许多人可以在没有一些非常用例特定的功能的情况下生活。

如上所述,上述所有规则并没有被直接违反,而是尚未以令人满意的方式实现,因此 CrateDB 最终没有理由不能成为一个完全关系型数据库 .

(免责声明:我在那里工作)