# 数据库模型

数据库模型是一种形式化的方式，用以规定数据在数据库中如何组织、如何关联、如何约束，以及允许对该结构执行哪些操作。模型决定了哪些查询是自然的、可以实施哪些完整性规则，以及如何从结构、关系、语义和约束的角度对数据作逻辑描述<sup>[20](https://opentextbc.ca/dbdesign01/chapter/chapter-5-data-modelling/)</sup>。广泛使用的模型包括层次模型、网状模型、关系模型、实体-关系模型、文档模型、键值模型、列族模型和图模型。

| 关键事实 | 详情 |
|---|---|
| 首个商用层次系统 | IMS 以层次数据模型为核心构建，于1968年8月14日在 NASA 的罗克韦尔航天部门发出第一条“READY”消息；IBM 于1968年在 System/360 上发布了该商用产品<sup>[1](https://www.ibm.com/history/information-management-system)</sup> |
| 关系模型 | E.F. Codd 于1970年的论文提出了一种基于 n 元关系的模型、一种数据库关系范式以及通用数据子语言的概念<sup>[2](https://research.ibm.com/publications/a-relational-model-of-data-for-large-shared-data-banks)</sup> |
| 实体-关系模型 | Peter P. Chen 在《ACM 数据库系统汇刊》1(1):9-36（1976年）上提出该模型，作为统一网状、关系和实体集三种数据视图的基础<sup>[3](https://researchr.org/publication/Chen76)</sup> |
| 网状模型 | CODASYL 数据库任务组（1969—1971年）为通过可导航记录关系组织的数据库形式化了模式、子模式和数据操纵操作<sup>[4](https://takuranyagumbo.com/item/institutions/the-database-task-group/)</sup> |
| 分布式权衡 | CAP 定理断言，使用不同位置数据的分布式系统在一致性、可用性和分区容错性三者中至多只能同时满足两项；Brewer 后来将这三个属性重新表述为连续的、可优化的<sup>[5](https://researcher.itu.dk/en/publications/the-cap-theorem-versus-databases-with-relaxed-acid-properties/)</sup> |
| 融合 | ISO/IEC 9075-16:2023（SQL/PGQ）于2023年6月发布，将属性图查询加入 SQL 标准；多模型数据库在同一平台上管理文档、图、关系和键值数据<sup>[6](https://www.iso.org/standard/79473.html?browse=tc)</sup><sup> • </sup><sup>[7](https://link.springer.com/article/10.1007/s10619-019-07279-6)</sup> |

## 层次模型与网状模型

最早广泛部署的数据库模型是层次模型，数据以父记录和子记录的树形结构排列。IBM 的信息管理系统（IMS）是典型代表。它创建于20世纪60年代，用于追踪数百万阿波罗火箭零件的物料清单，其商用产品将层次数据库管理系统与面向高吞吐量事务处理（如 ATM 取款和旅行预订）的软件结合在一起<sup>[1](https://www.ibm.com/history/information-management-system)</sup>。在 IMS 模型中，基本的构建单元是段之间的父/子关系：每个父段实例对应零个或多个子段实例，而每个子段实例恰好有一个父段实例<sup>[8](https://www.redbooks.ibm.com/redbooks/pdfs/sg245352.pdf)</sup>。

用 IBM 自己的话说，层次模型是一种务实的方式，能以很少的计算机资源快速存储和检索数据，不同于关系模型——后者是理论工作的产物<sup>[1](https://www.ibm.com/history/information-management-system)</sup>。它的效率取决于访问路径事先已知：专家必须为树形结构中的每次搜索硬编码指令，而当数据发生变化时，查询往往必须用新的指针重写<sup>[1](https://www.ibm.com/history/information-management-system)</sup>。一个结构性的后果至今仍保留在该产品中：层次数据库中的段沿层次路径与其父段和子段隐式连接，而关系数据库需要在两张表之间进行显式连接<sup>[9](https://www.ibm.com/docs/en/ims/15.6.0?topic=ims-comparison-hierarchical-relational-databases)</sup>。

网状模型将树推广为一种由命名关系连接的记录类型图。CODASYL 数据库任务组于1969年至1971年间形式化了其模式、子模式和数据操纵操作，IDMS 等系统实现了该方法<sup>[4](https://takuranyagumbo.com/item/institutions/the-database-task-group/)</sup>。层次系统和网状系统都称为导航式系统，因为应用程序沿着存储的指针到达数据，而不是以声明方式说明它们想要什么。

## 关系模型

1970年，时任 IBM 圣何塞研究实验室研究员的 [Edgar F. Codd](https://www.edgepedia.org/zh/edgar-f-codd) 在《ACM 通讯》上发表了《用于大型共享数据库的数据关系模型》。该论文主张，用户和大多数应用程序应当被保护而无需了解数据在机器中如何组织，并引入了一种基于 n 元关系的模型、一种数据库关系范式以及通用数据子语言的概念<sup>[2](https://research.ibm.com/publications/a-relational-model-of-data-for-large-shared-data-banks)</sup>。Codd 将此与现有格式化数据系统所提供的树形结构文件及稍为通用的网状模型进行了对比<sup>[2](https://research.ibm.com/publications/a-relational-model-of-data-for-large-shared-data-banks)</sup>。

该模型的实际效果是将逻辑表示与物理存储分离，使得由查询、更新和报表流量驱动的表示变化不会影响应用程序<sup>[2](https://research.ibm.com/publications/a-relational-model-of-data-for-large-shared-data-banks)</sup>。它也成为 SQL 的基础，使非专家更容易查找信息<sup>[1](https://www.ibm.com/history/information-management-system)</sup>。商业后果巨大：[Larry Ellison](https://www.edgepedia.org/zh/larry-ellison) 读了 Codd 的论文，与联合创始人 Robert Miner 和 Ed Oates 一起创立了这家软件公司，其产品于1979年以 Oracle V2 面世<sup>[10](https://www.computerhistory.org/revolution/memory-storage/8/265)</sup>。

## 实体-关系模型

实体-关系模型由 Peter P. Chen 于1976年提出，是一种设计层面的模型而非实现模型。它纳入了关于现实世界的语义信息，引入了一种图式技术作为数据库设计工具，并探讨了对数据完整性、信息检索和数据操纵的影响<sup>[3](https://researchr.org/publication/Chen76)</sup>。Chen 明确的目标是统一：该论文分析了网状、关系和实体集模型中的语义歧义，并提出了从实体-关系模型推导出它们各自数据视图的方法<sup>[3](https://researchr.org/publication/Chen76)</sup>。在实践中，无论采用哪种实现模型，实体-关系图仍然是从领域的概念描述到物理模式之间的一个标准步骤。

## NoSQL 数据模型

NoSQL 系统围绕四种主要模型组织数据：键值、文档、列族和图<sup>[11](https://www.mdpi.com/2076-3417/13/9/5770)</sup>。它们创建的首要目标是解决关系数据库效率方面的不足，特别是针对分布式和水平扩展的工作负载<sup>[11](https://www.mdpi.com/2076-3417/13/9/5770)</sup>。

**文档模型。** 文档数据库将自描述记录（通常是类 JSON 的）存储在集合中。MongoDB 的建模指南围绕一个决策：是将相关数据嵌入文档内部，还是引用存放在单独集合中的相关数据。嵌入是一种反规范化设计，使应用程序能够在单次操作中检索相关数据并在单次原子写入中更新，代价是跨集合重复存储频繁访问的数据<sup>[12](https://www.mongodb.com/docs/manual/data-modeling/embedding/)</sup>。该模型有一个硬性结构限制：MongoDB 文档必须小于16 MiB（即16×2²⁰字节），因此无限制增长的数组是一种反模式，需通过子集模式或引用来处理<sup>[12](https://www.mongodb.com/docs/manual/data-modeling/embedding/)</sup><sup> • </sup><sup>[13](https://www.mongodb.com/docs/manual/data-modeling/design-antipatterns/unbounded-arrays/)</sup>。

**图模型。** 图数据库将数据存储为节点、关系和属性，而非表或文档。节点表示实体，可以携带标签和属性；关系将源节点连接到目标节点，具有方向和类型，自身也可以持有属性<sup>[14](https://neo4j.com/docs/getting-started/graph-database/)</sup>。其设计目标是关系与数据原生存储在一起，而非通过连接操作重建，这支持对大型连通图进行快速遍历<sup>[14](https://neo4j.com/docs/getting-started/graph-database/)</sup>。查询就是一次遍历：要找出 [Tom Hanks](https://www.edgepedia.org/zh/tom-hanks) 出演了哪些电影，引擎从 Tom Hanks 节点出发，沿 ACTED_IN 关系到达 Movie 节点<sup>[15](https://neo4j.com/docs/getting-started/appendix/graphdb-concepts/)</sup>。

**一致性权衡。** CAP 定理结合了数据一致性、可用性和分区容错性，一直是对这些系统进行分类的标准词汇，NoSQL 运动将其作为反对传统 ACID 数据库的论据——后者以可用性为代价优先考虑一致性和分区容错性<sup>[5](https://researcher.itu.dk/en/publications/the-cap-theorem-versus-databases-with-relaxed-acid-properties/)</sup>。有两点限定值得注意。第一，Brewer 本人后来修改了该定理，指出这三个属性或多或少都是连续的，可以相互优化，因此实践中应用程序尽管存在网络分区，仍可以同时具有相对较高的可用性和足够的一致性<sup>[5](https://researcher.itu.dk/en/publications/the-cap-theorem-versus-databases-with-relaxed-acid-properties/)</sup>。第二，时任[剑桥大学](https://www.edgepedia.org/zh/university-of-cambridge)计算机科学家的 [Martin Kleppmann](https://www.edgepedia.org/zh/martin-kleppmann) 在2015年的一项分析中记录了 CAP 定义中的不一致和歧义及其形式化中的问题，并提出了一个延迟敏感性框架，分析操作延迟如何响应网络延迟，作为推理这些权衡的替代工具<sup>[16](https://arxiv.org/abs/1509.05393)</sup>。现代 NoSQL 系统还允许按操作调整一致性，因此将整个系统简单归类为 CA、CP 或 AP 在文献中被认为过于简单化<sup>[17](https://link.springer.com/article/10.1186/s40537-015-0025-0)</sup>。

## 模型的融合

自2010年代中期以来，各种模型一直在相互靠拢，而非相互取代。关系系统吸收了文档风格的数据：[PostgreSQL](https://www.edgepedia.org/zh/postgresql) 将 JSON 存储在 `json` 和 `jsonb` 类型中，并有用于 SQL/JSON 路径语言的 `jsonpath` 类型，其文档指出，将数据表示为 JSON 可以比传统关系模型灵活得多，同时建议即使是最灵活的 JSON 文档也应保持某种固定的结构<sup>[18](https://www.postgresql.org/docs/17/datatype-json.html)</sup>。反过来，SQL 标准现在也延伸到了图建模：ISO/IEC 9075-16:2023《属性图查询》（SQL/PGQ）第1版于2023年6月发布<sup>[6](https://www.iso.org/standard/79473.html?browse=tc)</sup>。

第二种融合是多模型数据库，它在单一集成后端上支持多种数据模型，如文档、图、关系和键值，这与[多语言持久化](https://www.edgepedia.org/zh/polyglot-persistence)不同——后者针对不同用例采用独立的数据存储<sup>[7](https://link.springer.com/article/10.1007/s10619-019-07279-6)</sup>。

基准测试对双方的声称都有所节制。在一项统一基准测试中，将关系数据映射为图数据、图数据映射为关系数据，并在相同数据集和指标上运行 TPC-H 和 LDBC 工作负载，关系系统和图系统都能管理这两种数据，但在面向业务的 TPC-H 工作负载中，图系统因其存储策略无法提供令人满意的性能；作者指出该问题可以通过适当的索引和模式调整来缓解<sup>[19](https://link.springer.com/article/10.1007/s41019-019-00110-3)</sup>。实践教训是，数据模型与其背后的存储引擎是分开的选择，没有哪种模型能主导所有工作负载。

## References

1. [Information Management Systems, IBM History](https://www.ibm.com/history/information-management-system)
2. [E.F. Codd (1970). A Relational Model of Data for Large Shared Data Banks, IBM Research](https://research.ibm.com/publications/a-relational-model-of-data-for-large-shared-data-banks)
3. [Peter P. Chen (1976). The Entity-Relationship Model - Toward a Unified View of Data, researchr](https://researchr.org/publication/Chen76)
4. [The Database Task Group, ITEM](https://takuranyagumbo.com/item/institutions/the-database-task-group/)
5. [L. Frank et al. The CAP Theorem Versus Databases with Relaxed ACID Properties, IT University of Copenhagen](https://researcher.itu.dk/en/publications/the-cap-theorem-versus-databases-with-relaxed-acid-properties/)
6. [ISO/IEC 9075-16:2023, SQL Part 16: Property Graph Queries (SQL/PGQ)](https://www.iso.org/standard/79473.html?browse=tc)
7. [C. Zhang and J. Lu (2019). Holistic evaluation in multi-model databases benchmarking, Distributed and Parallel Databases](https://link.springer.com/article/10.1007/s10619-019-07279-6)
8. [IMS Primer, Chapter 11: The IMS hierarchical database model, IBM Redbooks](https://www.redbooks.ibm.com/redbooks/pdfs/sg245352.pdf)
9. [IMS 15.6: Comparison of hierarchical and relational databases, IBM](https://www.ibm.com/docs/en/ims/15.6.0?topic=ims-comparison-hierarchical-relational-databases)
10. [Databases, CHM Revolution, Computer History Museum](https://www.computerhistory.org/revolution/memory-storage/8/265)
11. [Experimental Evaluation of Graph Databases, Applied Sciences (MDPI), 2023](https://www.mdpi.com/2076-3417/13/9/5770)
12. [Embedded Data in Your MongoDB Schema, MongoDB Docs](https://www.mongodb.com/docs/manual/data-modeling/embedding/)
13. [Avoid Unbounded Arrays, MongoDB Docs](https://www.mongodb.com/docs/manual/data-modeling/design-antipatterns/unbounded-arrays/)
14. [What is a graph database, Neo4j Getting Started](https://neo4j.com/docs/getting-started/graph-database/)
15. [Graph database concepts, Neo4j Getting Started](https://neo4j.com/docs/getting-started/appendix/graphdb-concepts/)
16. [M. Kleppmann (2015). A Critique of the CAP Theorem, arXiv](https://arxiv.org/abs/1509.05393)
17. [Choosing the right NoSQL database for the job: a quality attribute evaluation, Journal of Big Data](https://link.springer.com/article/10.1186/s40537-015-0025-0)
18. [PostgreSQL 17 Documentation, 8.14 JSON Types](https://www.postgresql.org/docs/17/datatype-json.html)
19. [Which Category Is Better: Benchmarking Relational and Graph Database Management Systems, Data Science and Engineering](https://link.springer.com/article/10.1007/s41019-019-00110-3)
20. [Chapter 5 Data Modelling, opentextbc.ca](https://opentextbc.ca/dbdesign01/chapter/chapter-5-data-modelling/)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Databases and data systems › Database theory and data modeling › Schema and data modeling methods

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/database-model

English original: https://www.edgepedia.org/database-model
