数据库系统 Computer Science

7 个科学问题 · 计算机 Computer Science

本页目录

数据库的四个隔离级别如何权衡一致性与并发性能?

How do the four isolation levels of a database trade off consistency against concurrency?

隔离级别从低到高依次为读未提交、读已提交、可重复读、串行化;级别越低并发越好但越容易出现脏读、不可重复读或幻读等问题。串行化通过加锁或串行执行消除所有异常,但吞吐量最低,系统常默认选择可重复读或读已提交以平衡二者。
From weakest to strongest the levels are read uncommitted, read committed, repeatable read, and serializable; weaker levels allow higher concurrency but admit anomalies like dirty reads, non-repeatable reads, or phantom reads. Serializable eliminates all anomalies via locking or serial execution but has the lowest throughput, so systems often default to repeatable read or read committed to balance the two.
难度 专业 · 适合 高中(15-18) CC BY 4.0 · 已核验 · Verified 2026-11-02
来源 · Source

Silberschatz《数据库系统概念》第14章 (机械工业出版社)

A. Silberschatz, H. Korth, S. Sudarshan, Database System Concepts, 7th ed., Chapter 14 (Transaction)

#事务 #隔离级别 #ACID

关系数据库的第三范式(3NF)通过什么方式减少数据冗余?

How does the third normal form (3NF) in relational databases reduce data redundancy?

3NF 要求每个非主属性既不部分依赖也不传递依赖于候选键,即非主属性必须直接由键决定。把传递依赖拆到独立的表中,就避免了同一事实在多处重复存储,从而减少更新异常和冗余。
3NF requires that every non-key attribute depends neither partially nor transitively on a candidate key, meaning it is determined directly by the key. By moving transitive dependencies into separate tables, the same fact is no longer stored in multiple places, reducing redundancy and update anomalies.
难度 专业 · 适合 高中(15-18) CC BY 4.0 · 来源待核验 · Source pending review
来源 · Source

出处备注:著录含书名,但缺版次 / 出版社 / 年份中的一部分,需编辑补全后才能做独立比对。

Codd 关系数据库理论原始论文与 Silberschatz《数据库系统概念》第8章 ; 另见: E. F. Codd, Further Normalization of the Data Base Relational Model (1971) and A. Silberschatz et al., Database System Concepts, 7th ed., Chapter 8 (Relational Database Design)

E. F. Codd, Further Normalization of the Data Base Relational Model (1971) and A. Silberschatz et al., Database System Concepts, 7th ed., Chapter 8 (Relational Database Design) ; see also: Codd 关系数据库理论原始论文与 Silberschatz《数据库系统概念》第8章

#第三范式 #规范化 #冗余

分布式数据库如何用两阶段提交保证跨节点事务的原子性?

How does a distributed database use two-phase commit to guarantee atomicity of cross-node transactions?

协调者先发起准备阶段,要求所有参与者预写日志并答复能否提交;收到全体赞成后才进入提交阶段正式提交,否则统一中止。若某参与者在准备后崩溃,协议依靠日志在恢复后继续完成或回滚,从而避免部分节点提交、部分回滚的不一致。
The coordinator first runs a prepare phase asking every participant to write its log and reply whether it can commit; only if all vote yes does it enter the commit phase to commit, otherwise it aborts uniformly. If a participant crashes after preparing, the protocol uses its log to finish or roll back on recovery, preventing the inconsistency of some nodes committing while others abort.
难度 专业 · 适合 高中(15-18) CC BY 4.0 · 已核验 · Verified 2026-11-02
来源 · Source

Silberschatz《数据库系统概念》第20章 (机械工业出版社)

A. Silberschatz, H. Korth, S. Sudarshan, Database System Concepts, 7th ed., Chapter 20 (Distributed Databases)

#两阶段提交 #分布式事务 #原子性

数据库视图(View)的主要用途是什么?

What is the main purpose of a database view?

视图是基于一条查询定义的虚拟表,本身不存储数据而只在被访问时动态计算结果。它可以隐藏底层表结构复杂度、限制用户可见列以加强安全,并简化常用查询的复用。
A view is a virtual table defined by a query; it stores no data but computes the result dynamically when accessed. It can hide the complexity of underlying tables, restrict the columns a user sees for security, and simplify reuse of common queries.
难度 进阶 · 适合 初中(12-15) CC BY 4.0 · 已核验 · Verified 2026-11-02
来源 · Source

Silberschatz《数据库系统概念》第4章 (机械工业出版社)

A. Silberschatz, H. Korth, S. Sudarshan, Database System Concepts, 7th ed., Chapter 4 (SQL)

#视图 #虚拟表 #安全

SQL 中的 JOIN 操作用于解决什么需求?

What need does the JOIN operation in SQL serve?

JOIN 把两个或多个表中满足关联条件的行组合起来,使一次查询就能跨表获取分散在不同表中的相关数据。常见的内连接只保留匹配行,外连接还会保留一侧未匹配的行并补空值。
JOIN combines rows from two or more tables that satisfy a related condition, letting one query pull related data spread across tables. An inner join keeps only matched rows, while an outer join also retains unmatched rows from one side, filling them with nulls.
难度 进阶 · 适合 大众 CC BY 4.0 · 已核验 · Verified 2026-11-02
来源 · Source

Silberschatz《数据库系统概念》第4章 (机械工业出版社)

A. Silberschatz, H. Korth, S. Sudarshan, Database System Concepts, 7th ed., Chapter 4 (SQL)

#SQL #JOIN #关系代数

数据库索引(如 B+ 树)为何能显著加快查询?

Why can a database index such as a B+ tree significantly speed up queries?

索引把列值组织成多层级的有序结构,查询时无需全表扫描,而是在树中沿路径以对数时间定位目标行。B+ 树的叶子节点以链表相连,还特别适合范围查询,但索引本身会占用空间并在写入时带来维护开销。
An index organizes column values into a multi-level ordered structure so a query need not scan the whole table but can reach the target row in logarithmic time by walking the tree. Because B+ tree leaf nodes are linked, it also suits range queries well, though the index consumes space and adds maintenance cost on writes.
难度 进阶 · 适合 初中(12-15) CC BY 4.0 · 已核验 · Verified 2026-11-03
来源 · Source

Ramakrishnan《数据库管理系统》第10章 (McGraw-Hill)

R. Ramakrishnan, J. Gehrke, Database Management Systems, 3rd ed., Chapter 10 (Tree-Structured Indexing)

#索引 #B+树 #查询优化

关系数据库中的主键和外键分别承担什么职责?

What roles do primary keys and foreign keys play in a relational database?

主键唯一标识表中的每一行,保证行可被无歧义地定位;外键引用另一表的主键,从而在两个表之间建立关联并维持引用完整性。借助外键,数据库能阻止指向不存在记录的无效关联。
A primary key uniquely identifies each row in a table so it can be located unambiguously, while a foreign key references the primary key of another table, linking the two and enforcing referential integrity. Through the foreign key the database can reject invalid links to non-existent records.
难度 进阶 · 适合 大众 CC BY 4.0 · 已核验 · Verified 2026-11-02
来源 · Source

Silberschatz《数据库系统概念》第2章 (机械工业出版社)

A. Silberschatz, H. Korth, S. Sudarshan, Database System Concepts, 7th ed., Chapter 2 (Relational Model)

#主键 #外键 #参照完整性