中科大高级数据库系统作业答案2015
(完整word版)2015年数据库期末考试试题和答案

试题一一、单项选择题(本大题共20小题,每小题2分,共40分)在每小题列出的四个备选项中只有一个是符合题目要求的,请将其代码填写在题后的括号内。
错选、多选或未选均无分.1. 数据库系统的核心是( B )A.数据库B.数据库管理系统C.数据模型D.软件工具2。
下列四项中,不属于数据库系统的特点的是(C )A.数据结构化B.数据由DBMS统一管理和控制C.数据冗余度大D.数据独立性高3.概念模型是现实世界的第一层抽象,这一类模型中最著名的模型是( D )A.层次模型B.关系模型C.网状模型D.实体—联系模型4。
数据的物理独立性是指( C )A.数据库与数据库管理系统相互独立B.用户程序与数据库管理系统相互独立C.用户的应用程序与存储在磁盘上数据库中的数据是相互独立的D.应用程序与数据库中数据的逻辑结构是相互独立的5.要保证数据库的逻辑数据独立性,需要修改的是( A )A.模式与外模式之间的映象B.模式与内模式之间的映象C.模式D.三级模式6.关系数据模型的基本数据结构是(D )A.树B.图C.索引D.关系7.有一名为“列车运营"实体,含有:车次、日期、实际发车时间、实际抵达时间、情况摘要等属性,该实体主码是( C )A.车次B.日期C.车次+日期D.车次+情况摘要8.己知关系R和S,R∩S等价于( B )A。
(R—S)-S B. S-(S—R)C。
(S-R)-R D。
S—(R—S)9.学校数据库中有学生和宿舍两个关系:学生(学号,姓名)和宿舍(楼名,房间号,床位号,学号)假设有的学生不住宿,床位也可能空闲。
如果要列出所有学生住宿和宿舍分配的情况,包括没有住宿的学生和空闲的床位,则应执行( A )A。
全外联接B. 左外联接C. 右外联接D。
自然联接10.用下面的T-SQL语句建立一个基本表:CREATE TABLE Student(Sno CHAR(4)PRIMARY KEY,Sname CHAR(8) NOT NULL,Sex CHAR(2),Age INT)可以插入到表中的元组是( D )A。
2015上半年数据库系统工程师考试真题及答案-下午卷

2015上半年数据库系统工程师考试真题及答案-下午卷试题一【说明】某大学为进一步推进无纸化考试,欲开发一考试系统。
系统管理员能够创建包括专业方向、课程编号、任课教师等相关考试基础信息,教师和学生进行考试相关的工作。
系统与考试有关的主要功能如下。
(1)考试设置。
教师制定试题(题目和答案),制定考试说明、考试时间和提醒时间等考试信息,录入参加考试的学生信息,并分别进行存储。
(2)显示并接收解答。
根据教师设定的考试信息,在考试有效时间内向学生显示考试说明和题目,根据设定的考试提醒时间进行提醒,并接收学生的解答。
(3)处理解答。
根据答案对接收到的解答数据进行处理,然后将解答结果进行存储。
(4)生成成绩报告。
根据解答结果生成学生个人成绩报告,供学生查看。
(5)生成成绩单。
对解答结果进行核算后生成课程成绩单供教师查看。
(6)发送通知。
根据成绩报告数据,创建通知数据并将通知发送给学生;根据成绩单数据,创建通知数据并将通知发送给教师。
现采用结构化方法对考试系统进行分析与设计,获得如图1-1所示的上下文数据流图和图1-2所示的0层数据流图。
【问题1】使用说明中的词语.给出图1-1中的实体E1—E2的名称。
E1:教师E2:学生本题考查采用结构化方法进行系统分析与设计,主要考查数据流图(DFD)的应用,是比较传统的题目,与往年相比考点类似,要求考生细心分析题目中所描述的内容。
DFD是一种便于用户理解、分析系统数据流程的图形化建模工具。
是系统逻辑模型的重要组成部分。
上下文DFD(顶层DFD)通常用来确定系统边界,将待开发系统本身看作一个大的加工(处理),然后根据谁为系统提供数据流,谁使用系统提供的数据流,确定外部实体。
建模出的上下文DFD中只有唯一的一个加工和一些外部实体,以及这两者之间的输入输出数据流。
在上下文确定的系统外部实体以及与外部实体的输入输出数据流的基础上,建模0层DFD,将上下文DFD中的加工进一步分解,成多个加工,识别这些加工的输入输出数据流,使得所有上下文DFD中的输入数据流,经过这些加工之后变换成上下文DFD的输出数据流。
中科院操作系统高级教程_思考题_2015最新版

1为什么计算机启动最开始的时候执行的是BIOS代码而不是操作系统自身的代码?计算机启动的时候,内存未初始化,CPU不能直接从外设运行操作系统,所以必须将操作系统加载至内存中。
而这个工作最开始的部分,BIOS需要完成一些检测工作,和设置实模式下的中断向量表和服务程序,并将操作系统的引导扇区加载值0x7C00 处,然后将跳转至0x7C00。
这些就是由bios程序来实现的。
所以计算机启动最开始执行的是bios代码。
2.为什么BIOS只加载了一个扇区,后续扇区却是由bootsect代码加载?为什么BIOS没有把所有需要加载的扇区都加载?对BIOS而言,“约定”在接到启动操作系统的命令后,“定位识别”只从启动扇区把代码加载到0x7c00这个位置。
后续扇区则由bootsect代码加载,这些代码由编写系统的用户负责,与BIOS无关。
这样构建的好处是站在整个体系的高度,统一设计和统一安排,简单而有效。
BIOS和操作系统的开发都可以遵循这一约定,灵活地进行各自的设计。
操作系统的开发也可以按照自己的意愿,内存的规划,等等都更为灵活3.为什么BIOS把bootsect加载到0x07c00,而不是0x00000?加载后又马上挪到0x90000处,是何道理?为什么不一次加载到位?1)因为BIOS将从0x00000开始的1KB字节构建了了中断向量表,接着的256KB字节内存空间构建了BIOS数据区,所以不能把bootsect加载到0x00000. 0X07c00是BIOS设置的内存地址,不是bootsect能够决定的。
2)首先,在启动扇区中有一些数据,将会被内核利用到。
其次,依据系统对内存的规划,内核终会占用0x0000其实的空间,因此0x7c00可能会被覆盖。
将该扇区挪到0x90000,在setup.s中,获取一些硬件数据保存在0x90000~0x901ff处,可以对一些后面内核将要利用的数据,集中保存和管理。
4.bootsect、setup、head程序之间是怎么衔接的?给出代码证据。
高级数据库系统选择题(附答案)

高级数据库系统选择题(附答案)目录Ordered Indexing and Hashing (1)Buffer Management (3)Bitmap Indices (5)Ordered Indices (7)B+ trees (8)Organization of Records in Files (10)Ordered Indexing and HashingThis set of Database Multiple Choice Questions & Answers (MCQs) focuses on “Ordered Indexing and Hashing”.1. A(n) ___c_____ can be used to preserve the integrity of a document or a message.a) Message digestb) Message summaryc) Encrypted messaged) None of the mentioned2. A hash function must meet ___b____ criteria.a) Twob) Threec) Fourd) None of the mentioned3. What is the main limitation of Hierarchical Databases? ba) Limited capacity (unable to hold much data)b) Limited flexibility in accessing datac) Overhead associated with maintaining indexesd) The performance of the database is poor4. The property (or set of properties) that uniquely defines each row in a table is called the:a) Identifierb) Indexc) Primary keyd) Symmetric key5. The separation of the data definition from the program is known as: ba) Data dictionaryb) Data independencec) Data integrityd) Referential integrity6. In the client / server model, the database: da) Is downloaded to the client upon requestb) Is shared by both the client and serverc) Resides on the client sided) Resides on the server side7. The traditional storage of data that is organized by customer, stored in separate folders in filing cabinets is an example of what type of ‘database’ system? aa) Hierarchicalb) Networkc) Object orientedd) Relational8. The database design that consists of multiple tables that are linked together through matching datastored in each table is called da) Hierarchical databaseb) Network databasec) Object oriented databased) Relational database9. The association role defines: aa) How tables are related in the databaseb) The relationship between the class diagram and the tables in the databasec) The tables that each attribute is containedd) Which attri bute is the table’s primary key10. The purpose of an N-Ary association is: ca) To capture a parent-child relationshipb) To deal with one to many relationshipsc) To deal with relationships that involve more than two tablesd) To represent an inheritance relationshipBuffer Management1. In order to reduce the overhead in retrieving the records from the storage space weuse ba) Logsb) Log bufferc) Medieval spaced) Lower records2. The order of log records in the stable storage ______ a ______ as the order in whichthey were written to the log buffer.a) Must be exactly the sameb) Can be differentc) Is opposited) Can be partially same3.Before a block of data in main memory can be output to the database, all log recordspertaining to data in that block must have been output to stable storage. This is (c)a)Read-write loggingb) Read-ahead loggingc) Write-ahead loggingd) None of the mentioned4. Writing the buffered log to ____d______ is sometimes referred to as a log force.a) Memoryb) Backupc) Redo memoryd) Disk5. The ______b________ policy, allows a transaction to commit even if it has modifiedsome blocks that have not yet been written back to disk.a) Forceb) No-forcec) Steald) No-steal6. ______b________ policy allows multiple updates to accumulate on a block before itis output to stable storage, which can reduce the number of output operations greatly for frequently updated blocks.a) Forceb) No-forcec) Steald) No-steal7.The ______c_____ policy, allows the system to write modified blocks to disk even ifthe transactions that made those modifications have not all committed.a) Forceb) No-forcec) Steald) No-steal8.Locks on buffer blocks are unrelated to locks used for concurrency-control oftransactions, and releasing them in a non-two-phase manner does not have any implications on transaction serializability. This is (a)a) Latchesb) Swap Spacec) Dirty Blockd) None of the mentioned9.The _________c_________ contains a list of blocks that have been updated in thedatabase buffer.a) Latchesb) Swap Spacec) Dirty Blockd) None of the mentioned10.The operating system reserves space on disk for storing virtual-memory pages thatare not currently in main memory; this space is called (b)a) Latchesb) Swap Spacec) Dirty Blockd) None of the mentionedBitmap Indices1. Bitmap indices are a specialized type of index designed for easy querying on_____c______b) Binary digitsc) Multiple keysd) Single keys2. A ___a____ on the attribute A of relation r consists of one bitmap for each value that Acan take.a) Bitmap indexb) Bitmapc) Indexd) Array3.SELECT *FROM rWHERE gender = ’f’ AND income level = ’L2’;In this selection, we fetch the bitmaps for gender value f and the bitmap for income level value L2, and perform an ___d___ of the two bitmaps.a) Unionb) Additionc) Combinationd) Intersection4.To identify the deleted records we use the _____a________a) Existence bitmapb) Current bitmapc) Final bitmapd) Deleted bitmap5.Bitmaps can be used as a compressed storage mechanism at the leaf nodes of____b____ for those values that occur very frequently.a) B-treesc) Bit treesd) Both B-trees and B+-trees6.Bitmaps can be combined with regular B+-tree indices for relations where a fewattribute values are extremely common, and other values also occur, but much less frequently. ba) Bitmap, B-treeb) Bitmap, B+treec) B-tree, Bitmapd) B+tree, Bitmap7.In a B+-tree index ___a___ for each value, we would normally maintain a list of allrecords with that value for the indexed attribute.a) Leafb) Nodec) Rootd) Link8. A tablespace is further broken down into ____b____a) Tablespaceb) Segmentsc) Extentsd) Blocks9.In ordered indices the file containing the records is sequentially ordered, a______a_____ is an index whose search key also defines the sequential order of the file.a) Clustered indexb) Structured indexc) Unstructured indexd) Nonclustered index10.Indices whose search key specifies an order different from the sequential order of thefile are called _____c______ indices.a) Nonclusteredb) Secondaryc) All of the mentionedd) None of the mentionedOrdered Indices1. In ordered indices the file containing the records is sequentially ordered, a_____a______ is an index whose search key also defines the sequential order of the file.a) Clustered indexb) Structured indexc) Unstructured indexd) Nonclustered index2.Indices whose search key specifies an order different from the sequential order ofthe file are called _____c______ indices.a) Nonclusteredb) Secondaryc) All of the mentionedd) None of the mentioned3.An _______a_____ consists of a search-key value and pointers to one or morerecords with that value as their search-key value.a) Index entryb) Index hashc) Index clusterd) Index map4.In a ___a____ clustering index, the index record contains the search-key valueand a pointer to the first data record with that search-key value and the rest of the records will be in the sequential pointers.a) Denseb) Sparsec) Straightd) Continuous5.In a ______a____ index, an index entry appears for only some of the search-keyvalues.a) Denseb) Sparsec) Straightd) Continuous6.Incase the indices values are larger, index is created for these values of the index.This is called (c)a) Pointed indexb) Sequential indexc) Multilevel indexd) Multiple index7. A search key containing more than one attribute is referred to as a ___b______search key.a) Simpleb) Compositec) Compoundd) Secondary8.In B+ tree the node which points to another node is called(d)a) Leaf nodeb) External nodec) Final noded) Internal node9.Insertion of a large number of entries at a time into an index is referred to as_______c___ of the index.a) Loadingb) Bulk insertionc) Bulk loadingd) Increase insertion10.While inserting the record into the index, if the search-key value does not appearin the index. (c)a) The system adds a pointer to the new record in the index entryb) The system places the record being inserted after the other records with thesame search-key valuesc) The system inserts an index entry with the search-key value in the index at theappropriate positiond) None of the mentionedB+ trees1. State true or false: B+ trees are not always balanced trees. ba) Trueb) False2.What are the leaf nodes in a B+ tree? ba) The topmost nodesb) The bottommost nodesc) The nodes in between the top and bottom nodesd) None of the mentioned3.Non-leaf nodes are also called as _____a_____a) Internal nodesb) External nodesc) Middle nodesd) Primary nodes4.The queries used to find all records with search key values in a particular range areknown as ___c_____a) Gap queriesb) Graph queriesc) Range queriesd) None of the mentioned5.Statement 1: Insertion of record might require the change in position of the initialnodes.Statement 2: Deletion of records might require the change in position of the initial nodes. (a)a) Both the statements are trueb) Statement 1 is true but statement 2 is falsec) Statement 2 is true but statement 1 is falsed) Both the statements are false6.If a relation can have more than one record containing the same search key value, thesearch key is said to be a ____b______a) Unique search keyb) Non unique search keyc) Multiple search keyd) Identical search key7.State true or false: The fanout of nodes can be increased by using a technique called____a_____a)Prefix compressionb) Postfix compressionc) Prefix expansiond) Postfix expansion8. Insertion of a large number of entries at a time into an index is referred to as ___a____ of the index.a) Bulk loadingb) Mass insertionc) Quick insertiond) Quick loading9._____b______ are the indices that store the values of some attributes along with the pointers to the recor.a) Binary indicesb) Covering indicesc) Key indicesd) Static indicesOrganization of Records in Files1. If a piece of data is stored in two places in the database, thena) Storage space is wastedb) Changing the data in one spot will cause data inconsistencyc) In can be more easily accessedd) Storage space is wasted & Changing the data in one spotwill cause data inconsistencyAnswer: dExplanation: The database is always consistent and so there is no duplication.2.An audit trail ___________a) Is used to make backup copiesb) Is the recorded history of operations performed on a filec) Can be used to restore lost informationd) None of the mentionedAnswer: bExplanation: This is more useful for all recovery actions.3. Large collection of files are called ____________a) Fieldsb) Recordsc) Databased) SectorsAnswer: cExplanation: The operator tree has a tree like format where the evaluation starts from root of the tree .4. Which of the following hardware component is the most important to the operation of a database management system?a) High resolution video displayb) Printerc) High speed, large capacity diskd) MouseAnswer: cExplanation: All the data are stored in form of memory in the disk.5. Which of the following is not true of the traditional approach to information processinga) There is common sharing of data among the various applicationsb) It is file orientedc) Programs are dependent on the filed) It is inflexibleAnswer: aExplanation: All the data are stored in form of memory in the disk.6. Which of these is not a feature of Hierarchical model?a) Organizes the data in tree-like structureb) Parent node can have any number of child nodesc) Root node does not have any parentd) Child node can have any number of parent nodesAnswer: dExplanation: The data are traversed using several algorithms.7. Which of these data models is an extension of the relational data model?a) Object-oriented data modelb) Object-relational data modelc) Semi structured data modeld) None of the mentionedAnswer: bExplanation: All the data are stored in form of memory in the disk.8. The information about data in a database is called _______a) Metadatab) Hyper datac) Tera datad) None of the mentionedAnswer: aExplanation: Metadata is information about a data.9. A data dictionary is a special file that contains?a) The names of all fields in all filesb) The data types of all fields in all filesc) The widths of all fields in all filesd) All of the mentionedAnswer: dExplanation: The data dictionary is structured in tables and views, just like other database data.10. The DBMS acts as an interface between what two components of an enterprise-class database system?a) Database application and the databaseb) Data and the databasec) The user and the database applicationd) Database application and SQLAnswer: aExplanation: Database application is the interface with the user to access the database.。
数据库高级试题及答案

数据库高级试题及答案一、单项选择题(每题2分,共10分)1. 在关系数据库中,关系是指()。
A. 属性B. 实体C. 表格D. 域答案:C2. SQL语言中,用于创建新表的命令是()。
A. SELECTB. INSERTC. CREATE TABLED. DROP TABLE答案:C3. 数据库管理系统(DBMS)的主要功能不包括()。
A. 数据定义B. 数据操纵C. 数据备份D. 数据加密答案:D4. 在关系数据库中,表与表之间的联系称为()。
A. 索引B. 视图C. 关系D. 约束答案:C5. 如果一个表中的某个字段只能包含一个值,那么这个字段具有()。
A. 唯一性B. 主键C. 外键D. 索引答案:A二、多项选择题(每题3分,共15分)1. 以下哪些是关系数据库的组成部分?()A. 数据B. 表C. 视图D. 索引答案:ABC2. SQL语言中,以下哪些命令用于数据操纵?()A. SELECTB. INSERTC. UPDATED. DELETE答案:ABCD3. 在数据库设计中,以下哪些是规范化的原则?()A. 第一范式(1NF)B. 第二范式(2NF)C. 第三范式(3NF)D. 反规范化答案:ABC4. 数据库的安全性包括哪些方面?()A. 数据加密B. 用户认证C. 访问控制D. 数据备份答案:ABC5. 以下哪些是数据库的完整性约束?()A. 主键约束B. 外键约束C. 唯一性约束D. 检查约束答案:ABCD三、填空题(每题2分,共10分)1. 在数据库中,用于唯一标识每个记录的字段称为________。
答案:主键2. 用于在两个表之间建立联系的字段称为________。
答案:外键3. 数据库中的________用于限制字段值的类型。
答案:数据类型4. 用于在数据库中存储和检索数据的SQL语句是________。
答案:SELECT5. 用于删除数据库表的SQL语句是________。
中科大高级数据库系统作业答案2015

如果系统故障时, 磁盘上记录的Log记录下, 请描述数据库恢复管理器的动作.
a) <U,Start> b) <U,Commit> c) <T,E,50> d) <T,Commit>
1.(a)undo U, undo T (不能是undo T,undo U ) 1. Undo是逆向完成 (b)undo T, redo U 2. Redo是顺序完成 3. 必须先Undo 后Redo (c)undo T, redo U (d)redo T, redo U
3
第二次作业
解:首先完善模型如下: 假定:本地读写的代价可忽略不计; 异地读写操作的代价均相等,记为1
A方案 A1 A2 B方案 5 (r R2) 0 5 (r R2) 0 10(r R2) 10 (r R2) 10 (w R2) 10 (w R2)
A> R1在Site1, R2在Site2, R3在 Site3. B> R1和R2在Site1, R2和R3在 Site3. A1: 在Site1上发出, 读5个 R1 记录, 5个 R2记录 A2: 在Site3上发出, 读5个R3记 录 , 5个R2记录 A3: 在Site2上发出, 读10个R2 记录.
(1) 所有表存放于站点A: 部门1要经常访问所有雇员和项目信息 (2) 因为站点B和C分别属于部门2和3,所以先对DEPARTMENT按DNO水平分片, 取DNO=2、3 分别得到部门2和3的数据存放于站点B和C (3)将EMPLOYEE、PROJECT以及DEPT_LOCATION分别和部门2和3的DEPARTMENT 数据在DNO属性上半连接,得到部门2和3上的EMPLOYEE、PROJECT以及 DEPT_LOCATION数据 5
高级数据库系统及其应用课后习题参考答案

第4章数据存储与组织管理4.1 简要答复以下问题。
(1)描述磁盘空间管理器的主要作用,并说明它与OS文件系统的关系。
(2)解释关系数据库系统中关系表与文件的关系。
(3)如果有一个大文件需要频繁执行顺序扫描,那么,为该文件选择哪种页存储方式最适宜?(4)分别描述持久化指针解引用(dereference)和指针混写的这两个根本过程,它们之间有何联系?(5)说明排序文件中的记录及页的根本存储组织方式。
(6)解释缓冲区管理器处理一个读页请求的过程。
如果被请求页位于缓冲池但未被闩住(pinned),那么情况会怎样?缓冲区管理器何时写一个磁盘页?(7)一个缓存页被闩住〔be pinned〕意味着什么?一般由谁负责给缓存页上闩,由谁负责给缓存页解闩?(8)当一个页请求发生时,如果缓冲池中所有页都是脏页,将会发生什么?(9)与OS缓存管理相比,DBMS缓冲区管理器具有那些独特的重要能力?(10)什么是预取?解释为什么这种策略很重要。
(11)描述两种可能的记录格式,并指明它们的优缺点。
(12)描述两种可能的页格式,说明它们优缺点和适用场合。
【解答】〔1〕磁盘空间管理器支持以页(page)为单位的数据管理,隐藏了下层硬件〔甚至包括OS文件管理〕的细节,且允许高层软件认为DB 数据是一系列以页为单位的磁盘数据集合,是DBMS 体系结构中最低层的软件模块。
DB系统的磁盘空间管理器通常按三种方式来应用OS的文件管理功能:⏹将整个DB存储在一个或几个磁盘文件中,调用OS功能实现流式文件的磁盘R/W。
⏹让OS分配给DB系统一个或几个大的OS文件,然后自己管理〔读/写〕这个文件。
⏹完全自己来管理磁盘。
〔2〕通过磁盘空间管理器,可将DB中的“关系〞映射到“关系数据文件〞,这种“文件〞既可能是实际的OS文件,也可能只是一个虚拟的OS文件。
一些小规模的DB系统实现甚至可能将关系直接存储在单独的OS文件中。
但更多的现代大型DB系统,那么是把所有关系都集中存储在一个或几个大文件中的复杂结构。
中国科学院大学数据库新技术期末复习(提纲+答案整理)

第1章关系数据库模型和关系运算要求掌握的基本概念和理论1.与网状和层次数据库相比,关系数据库有哪些优点?(1)数据结构单一,不管实体还是实体之间的联系都用关系来表示;(2)建立在严格的数学概念基础上,具有坚实的理论基础;(3)将数据定义和数据操纵统一在一种语言中,使用方便,易学易用。
2.试述关系模型的完整性规则答:关系模型的完整性规则包括:实体完整性、参照完整性、用户定义的完整性。
实体完整性规则是指若属性A是基本关系R的主属性,则属性A不能取空值。
参照完整性:若属性(或属性组)F是基本关系R的外键,它与基本关系S的主码Ks相对应(基本关系R和S不一定是不同的关系),则对于R中每个元组在F上的值必须为:或者取空值(F的每个属性值均为空值);或者等于S中某个元组的主码值。
用户定义的完整性指数据间应满足的语义约束关系,由用户定义,由系统检查。
3.试述等值连接与自然连接的区别和联系答:连接运算符是“=”的连接运算称为等值连接。
它是从关系R与S的广义笛卡尔积中选取A,B属性值相等的那些元组自然连接是一种特殊的等值连接,它要求两个关系中进行比较的分量必须是相同的属性组,并且在结果中把重复的属性列去掉。
4.函数依赖、部分依赖、完全依赖、传递依赖、平凡依赖函数依赖:对X中的任一值x,ΠY (σX=x(r))的值仅有一个元组,则有X→Y。
设FD X→Y,如果对任意的X⊂'X,X'→Y都不成立,则称X→Y是完全函数依赖;若对X的真子集X'有X⊂'X,而X'→Y成立,则称FD X→Y是部分函数依赖。
设关系模式R,X、Y、Z是R的属性子集,若FD X→Y,Y!→X,Y→Z,则有FD X→Z,称FD X→Z为传递函数依赖。
设FD X→Y,如果Y⊄X,则称FD X→Y为非平凡的函数依赖;否则,若Y⊆X,称FD X→Y为平凡的函数依赖。
5.函数依赖公理和推论Armstrong公理:设r是R(U)上的一个关系,X、Y、Z、W⊆U。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
2*2
c),选择P1进行优化
21
R’ = R∝S’
A
2
B
3
C
5
1 5
2
6 3
6
8 5
8
d) 选择p3继续进行优化
S’’ = S’ ∝ T’ B C D
最终得到的关系如下:
R(站点X) S(站点Y) T(站点Z)
3
6
5
8
6
3
22
所以选择各站点做连接的代价为: X站点代价=2*3+2*3=12 Y站点代价=3*4+2*3=18 Z站点代价=3*4+2*3=18 故选择X站点作为收集站点代价最低
8
第三次作业
3.6(续) R∝S
S∝R
S∝T
T∝ S
D 6 3 E 6 8 I 9 9
R∝ T 、T∝R 为空
9
第三次作业
10
第三次作业
3.8 解:
1)将Boce站点上的副本传至Toronto站点; 2)在New York站点上求平均工资,传至Toronto 站点; 3)Toronto, Edmonton, Vancouver, Montreal求最 高工资,传至Toronto汇总;
如果系统故障时, 磁盘上记录的Log记录如下, 请描述数据库恢复管理器的动作.
a) <U,Start> b) <U,Commit> c) <T,E,50> d) <T,Commit>
25
1.假设两个事务T 和 U 的 log 记录如下所示:
第五次作业
<T,Start>,<T,A,10>,<U,Start>,<U,B,20>,<T,C,30 >,<U,D,40>,<U,Commit>,<T,E,50>,<T,Commit>
第四次作业
17
第四次作业
方案 使用SJ在R站点 JN 使用SJ在S站点 JN 直接在R站点JN 直接在S站点JN
(1)R本地在A上投影后PJA(R)发送到S (2)S在本地与PJA(R)做SJ后发送回R (3)在R站点完成最后JN (1)S本地在B上投影后PJB(S)发送到R (2)R在本地与PJB(S)做SJ后发送回S (3)在S站点完成最后JN
PJ name JN D#=D#
PJ D#,name D1
PJ D# SL treat=’intensing’ P1
PJ D#,name D2
PJ D# SL treat=’intensing’ P3
PJ D#,name D3
P2 无符合条件的元组
D1 与P3 JN为空
16
D2 与P1 JN为空
D3 与P1 JN为空
Care
全局关系转化为 分段关系
Patient Care
13
第三次作业
(a)
PJ SL Drug=’Aspirin’ ^ Patient.DEPT=’Surgery’ UN JN P#=P# JN P#=P# JN P#=P#
上推UN 下推PJ 和 SL
Patient1 Care1 Patient2 Care2 Patient3 Care3
已知有如下两种段分配: A> R1在Site1, R2在Site2, R3在Site3. B> R1和R2在Site1, R2和R3在Site3. 另已知有如下应用(所有应用的频率相同) A1: 在Site1上发出, 读5个 R1记录, 5个 R2记录 A2: 在Site3上发出, 读5个R3记录 , 5个R2记录 A3: 在Site2上发出, 读10个R2记录. 问: 1. 如果以本地应用为主要设计目标, 那个分配较优? 2. 假定A3改为要修改10个R2记录, 并仍以本地应用为 其设计目标, 则那个分配方案较优?
15
第三次作业
(b)全局关系上的查询表达式 Doctor . Name Patient .Treat ' Intensing ' Doctor Doctor .D #Patient .D # Patient
UN
PJ name JN D#=D#
PJ name JN D#=D#
如果系统故障时, 磁盘上记录的Log记录下, 请描述数据库恢复管理器的动作.
a) <U,Start> b) <U,Commit> c) <T,E,50> d) <T,Commit>
1.(a)undo U, undo T (不能是undo T,undo U ) 1. Undo是逆向完成 (b)undo T, redo U 2. Redo是顺序完成 3. 必须先Undo 后Redo (c)undo T, redo U (d)redo T, redo U
传输代价
(1) C0+C1*Size(A)*Val(A[R]) (2) C0+C1*Size(S)*Card(S)*ρS SJ R
代价和 2C0+350C1 2C0+1150C1
(1) C0+C1*Size(B)*Val(B[S]) (2) C0+C1*Size(R)*Card(R)*ρR SJ S
(1) 所有表存放于站点A: 部门1要经常访问所有雇员和项目信息 (2) 因为站点B和C分别属于部门2和3,所以先对DEPARTMENT按DNO水平分片, 取DNO=2、3 分别得到部门2和3的数据存放于站点B和C (3)将EMPLOYEE、PROJECT以及DEPT_LOCATION分别和部门2和3的DEPARTMENT 数据在DNO属性上半连接,得到部门2和3上的EMPLOYEE、PROJECT以及 DEPT_LOCATION数据 5
即: (R∝(S∝R)) ∞ ((S∝R)∝(T∝(S∝R)) ∞ (T∝(S∝R))
R’
S’ S’’
24
T’
T’
第五次作业
1.假设两个事务T 和 U 的 log 记录如下所示:
<T,Start>,<T,A,10, 25>,<U,Start>,<U,B,20,15>,<T,C,30,20>, <U,D,40,30>,<U,Commit>,<T,E,50,70>,<T,Commit>
14
第三次作业
(a)
UN PJ JN P#=P# PJ JN P#=P#
PJ P#,name Patient1
PJ P# SL Drug=’Aspirin’ Care1
PJ P#,name Patient2
PJ P# SL Drug=’Aspirin’ Care2
12
第三次作业
(a) 全局关系上的查询表达式(列出在Care中使用‘Aspirin’的Patient 名字) Patient . Name Care. Drug ' Aspirin ' Patient . DEPT ' Surgery ' Patient
PJ SL Drug=’Aspirin’ ^ Patient.DEPT=’Surgery’ JN P#=P#
3
第二次作业
解:首先完善模型如下: 假定:本地读写的代价可忽略不计; 异地读写操作的代价均相等,记为1
A方案 A1 A2 B方案 5 (r R2) 0 5 (r R2) 0 10(r R2) 10 (r R2) 10 (w R2) 10 (w R2)
A> R1在Site1, R2在Site2, R3在 Site3. B> R1和R2在Site1, R2和R3在 Site3. A1: 在Site1上发出, 读5个 R1 记录, 5个 R2记录 A2: 在Site3上发出, 读5个R3记 录 , 5个R2记录 A3: 在Site2上发出, 读10个R2 记录.
6
第三次作业
7
第三次作业
3.6
A B C D 2 3 5 6
解:R JN S =
2 3 5 9
1 6 8 3 5 3 5 6 5 3 5 9
2 6 8 3
A B C D E I 2 3 5 6 6 9 1 6 8 3 8 9 5 3 5 6 6 9 2 6 8 3 8 9
R JN S JN T =
(1)S发送到R直接JN
(1)C0+C1*Size(S)*Card(S)
C0+250C1 C0+5000C1
(1)R发送到S直接JN
(1)C0+C1*Size(R)*Card(R)
18
第四次作业
3.7如果习题中的三个关系R,S,T分别位于三 个不同的站点X,Y,Z。若采用基于半连接的 算法计算R∞S∞T,请选择使得传输代价最小 的连接执行站点和确定半连接序列
高级数据库系统作业答疑
2016.1
1
第一次作业
1. 用自己语言定义下列分布式数据库系统中的术语。 全局/局部数据、全局/局部DBMS、 全局外/概念模式等 (第一章)
2. 分布式数据库系统分类?P6-8
3.分布式DBMS具有哪些集中式DBMS不具备的功能? (P15,34)
(见课本)
2
第二次作业
X
Y19
Z
第四次作业
假设每个属性域长度均为1B,考虑所有的半连接
在有益方 案中选择 得益最高 的或者费 用最少的 方案进行 优化