计算机科学概论第九章,计算机科学概论第九章.ppt

计算机科学概论第九章

9-* Maintaining database integrity (continued)维护数据库的完整性 Simultaneous access problems同步进程问题 Incorrect summary problem错误决算问题 Lost update problem更新丢失问题 Locking = preventing others from accessing data being used by a transaction锁定:防止其他人获取事务所使用的数据 Shared lock: used when reading data共享锁:读取数据时使用的锁 Exclusive lock: used when altering data排它锁:选择数据时使用的锁 9-* Sequential Files顺序文件 Sequential file: A file whose contents can only be read in order顺序文件:文件中的内容是按照顺序执行的 Reader must be able to detect end-of-file (EOF)必须能够检测文件结束 Data can be stored in logical records, sorted by a key field数据可以由一个关键字域以逻辑存储的方式存储 Greatly increases the speed of batch updates极大地提高了批量更新的速度 9-* Figure 9.14 The structure of a simple employee file implemented as a text file图9.14 以文本文件实现的一个简单员工文件结构 9-* Figure 9.15 A procedure for merging two sequential files图9.15 归并两个顺序文件的过程 Figure 9.16Applying the merge algorithm (Lettersare used to represent entire records.?The particular letter indicates the value of the record’s key field.)图9.16 归并算法的应用(字母用于代表整条记录,具体字母表示记录的键字段的值) 9-* Indexed Files索引文件 Index: A list of key values and the location of their associated records索引:一个关键字的列表以及与它们相关的记录的位置 9-* Figure 9.17 Opening an indexed file图9.17 打开索引文件 9-* Hashing散列 Each record has a key field每一个记录都有一个关键域 The storage space is divided into buckets数据存储空间被分成几个存储桶 A hash function computes a bucket number for each key value散列函数将键的值转换为桶号 Each record is stored in the bucket corresponding to the hash of its key每条记录存放在通过散列函数处理确定的桶里 9-* Figure 9.18 Hashing the key field value 25X3Z to one of 41 buckets图9.18 将键字段值25X3Z散列到41个桶中的一个 9-* Figure 9.19 The rudiments of a hashing system图9.19 散列系统的基本原理 9-* Collisions in Hashing在散列中碰撞 Collision: The case of two keys hashing to the same bucket碰撞:两个键经过散列后得到同一个值的情况 Major problem when table is over 75% full当表格超过75%以上的内容满了是就发生了碰撞 Solution: increase number of buckets and rehash all data解决方法:增加桶的数量并重新定义所有的数据 9-* Data Mining数据挖掘 Data Mining: The area of computer science that deals with discovering pattern

你可能感兴趣的:(计算机科学概论第九章)