Ch1 introduction to database systems(笔记+习题)

笔记

scheme:根据数据模型和描述的数据结构
transaction:DBMS的访问逻辑单元
Checkpointing:周期性操作,减少从系统崩溃恢复的时间
DBMS组成:硬盘管理模块、缓冲区管理模块、文件和索引结构体层、关系运算符实现器、查询优化器等
shared locks:共享锁
exclusive lock:互斥锁
用户查询->查询解析器(解析后发送)->查询优化器(产生高效执行计划,通常为关系运算符树)

Exercises

Exercise 1.1 Why would you choose a database system instead of simply storing data inoperating system files? When would it make sense not to use a database system?
用操作系统的文件存储有如下缺点:

1.主存无法存下太大量的数据。

2.即使主存能存的下,32位系统也无法直接引用超过4GB的数据。

3.需要编写一个能满足各种复杂查询的程序。

4.必须保护数据免受非一致性修改。

5.必须确保数据被存储在同一区域。

6.操作系统只通过密码来提供安全性,不能灵活地执行安全策略。

而用数据库系统存储能保证数据的独立性、高效存取、完整性、安全性、简便管理、并行访问、快速恢复,以及明显缩短应用开发的世界。
不使用数据库系统的原因有:1.DBMS是一个极其复杂的软件,可能不适合某些特殊应用,如实时应用。2.应用可能需要以查询语言不支持的方式操作数据。

Exercise 1.2 What is logical data independence and why is it important?
数据独立性是指应用程序不受数据的逻辑结构的变化或存储关系变化的影响。这使得我们可以在不改变应用程序的情况下更改存储细节。

Exercise 1.3 Explain the difference between logical and physical data independence.
逻辑数据独立性强调应用程序与数据的逻辑结构相互独立,应用程序不受数据逻辑结构变化的影响,而物理数据独立性强调应用程序与数据库中数据相互独立,应用程序不需要了解DBMS如何存储数据。逻辑数据独立性比物理数据独立性更难做到,因为应用程序很依赖数据的存储结构。

Exercise 1.4 Explain the difference between external, internal, and conceptual schemas.How are these different schema layers related to the concepts of logical and physical data independence?
外部模式描述特定用户感兴趣的数据库部分,例如,来自销售部门的用户将仅看到与销售相关的数据;内部模式定义数据库的物理结构,是非常底层的表示;概念模式描述了整个数据库结构,隐藏了具体实现细节,专注于描述数据类型,实体,关系等。模式之间存在映射关系,当概念模式改变时,只要改变外部模式-概念模式的映射关系,就可以使外模式保持不变,对应的应用程序也可保持不变,这就保证了逻辑数据独立性;当数据的存储结构发生变化时,只需改变概念模式一内部模式映射,就能保持概念模式不变,对应的应用程序也可保持不变,这就保证了物理数据独立性。

Exercise 1.5 What are the responsibilities of a DBA? If we assume that the DBA is never interested in running his or her own queries, does the DBA still need to understand query optimization? Why?
DBA的职责:1.设计概念模式和物理模式。2.确保用户认证和安全性。3.确保数据可访问和系统崩溃后及时恢复数据。4.用户需求变化时对数据库进行相应修改。
DBA需要理解查询优化,因为DBA需要保证用户的查询经过优化后能访问到数据。

Exercise 1.6 Scrooge McNugget wants to store information (names, addresses, descriptions of embarrassing moments, etc.) about the many ducks on his payroll. Not surprisingly, the volume of data compels him to buy a database system. To save money, he wants to buy one with the fewest possible features, and he plans to run it as a stand-alone application on his PC clone. Of course, Scrooge does not plan to share his list with anyone. Indicate which of the following DBMS features Scrooge should pay for; in each case also indicate why Scrooge should (or should not) pay for that feature in the system he buys.
1. A security facility.需要,出于隐私保护。
2. Concurrency control.不需要,因为此数据库只有单个用户。
3. Crash recovery.需要,系统可能崩溃,需要此功能。
4. A view mechanism.需要,对访问数据有帮助。
5. A query language.需要,需要访问数据。

Exercise 1.7 Which of the following plays an important role in representing information about the real world in a database? Explain briefly.
1. The data definition language.定义表的结构
2. The data manipulation language.对表里的数据进行操作
3. The buffer manager.提高存取效率
4. The data model.描述数据与实体的关系

Exercise 1.8 Describe the structure of a DBMS. If your operating system is upgraded to support some new functions on OS files (e.g., the ability to force some sequence of bytes to disk), which layer(s) of the DBMS would you have to rewrite in order to take advantage of these new functions?
Disk Space Manager这一层。

Exercise 1.9 Answer the following questions:
1. What is a transaction?
用户程序一次运行的所有数据库操作。
2. Why does a DBMS interleave the actions of different transactions, instead of executing
transactions one after the other?
因为不同事务之间可能相互影响。
3. What must a user guarantee with respect to a transaction and database consistency?
What should a DBMS guarantee with respect to concurrent execution of several transactions
and database consistency?
用户不能进行一个数据库不允许的事务。DBMS必须保证多个事务的顺利进行,且不相互影响,数据库的一致性不被并发执行所影响。
4. Explain the strict two-phase locking protocol.
锁协议包括互斥锁和共享锁。一个事务在执行前必须启动锁,并且执行完成之前不释放锁。
5. What is the WAL property, and why is it important?
预写日志记录了数据库在改变映射关系前的每一次写操作。当执行事务时数据库崩溃,它能保护数据库。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章