Note: CHAPTER 2 Data Models and Query Languages

?

  • 有哪些 data model? 它们之间的区别和联系是什么? 各自解决了什么场景下的问题? 如何融合?
  • 每个 data model 对应的 query language 是什么? 有什么特点?
  • 关系型和文档型之间的差异是什么?
  • 什么是 nosql? data model 和 query language 的历史发展?
  • it’s just a question of whether the schema is explicit (enforced on write) or implicit (handled on read)?
  • 关系型数据库的限制?什么导致了这些限制?如何打破这些限制?

Overview

许多应用都由分层的 data-model 组成,上层屏蔽下层的复杂性,data-model 决定我们解决问题的思维模式.本节介绍 relational model, document model, graph-based model 3 种 data-model 和其对应的 query language。

Relational model 解决数据之间 many-to-many 关系的问题,但是无法适应所有应用场景,于是 NoSQL datastore 应运而生,主要分为 2 大类:

  1. Doucument database: Document databases target use cases where data comes in self-contained documents and relationships between one document and another are rare.

  2. Graph databases: Graph databases go in the opposite direction, targeting use cases where anything is potentially related to everything.

适应于一个 data-model 的数据也可以用其他的 data-model 来组织,比如: graph data can be represented in a relational database。用不合适的 data-model 来组织数据会使得数据变得难以使用, That’s why we have different systems for different purposes, not a single one-size-fits-all solution.

定义数据存储格式 -> 在其上定义查询语言.

Relational Model Versus Document Model

Relational Model

Relational Model 由 row(tuple) 组成 table(relation),主要的 use case 是 transaction processingbatch processing。其屏蔽了底层存储的实现细节,对外提供 sql 这种声明式的 query language.

Object-oriented 和 relational model 之间存在差异,需要 orm(mybatis 等), 但是也无法完全屏蔽这种差异.

A key insight of the relational model was this: you only need to build a query optimizer once, and then all applications that use the database can benefit from it

Document Model

适用于数据之间 one-to-many 的关系,对 join 支持比较弱.

NoSql(Not Only SQL) 产生驱动因素:

  • A need for greater scalability than relational databases can easily achieve, includ‐ing very large datasets or very high write through
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值