文件组织的标准 Rapid access(快速存取) needed when accessing a single record not needed for batch mode Ease of update(易于修改) file on CD-RoM will not be updated, so this is not a concern ◆ Economy of storage(存储的经济性 should be minimum redundancy in the data(数据最小冗余) redundancy can be used to speed access such as an index(EFI 会增加冗余但为提高存取速度) Simple maintenance(易于维护) ◆ Reliabilit!y(可靠)
文件组织的标准 Rapid access(快速存取) – needed when accessing a single record – not needed for batch mode Ease of update(易于修改) – file on CD-ROM will not be updated, so this is not a concern Economy of storage(存储的经济性) – should be minimum redundancy in the data(数据最小冗余) – redundancy can be used to speed access such as an index(索引 会增加冗余但为提高存取速度) Simple maintenance(易于维护) Reliability (可靠)
File organization(文件的逻辑组织 l、 The pile(堆文件) data are collected in the order they arrive(数据按到达次序堆放) purpose is to accumulate a mass of data and save it(积累数据并 保存) records may have different fields(记录即每次获得的数据可能具 有不同的结构) no structure(文件没有统计的记录结构) record access is by exhaustive search(信息查找需要遍历) 记录1 记录2 记录3 记录4 记录 记录6
File Organization(文件的逻辑组织) 1、The Pile(堆文件) – data are collected in the order they arrive(数据按到达次序堆放) – purpose is to accumulate a mass of data and save it(积累数据并 保存) – records may have different fields(记录即每次获得的数据可能具 有不同的结构) – no structure(文件没有统计的记录结构) – record access is by exhaustive search(信息查找需要遍历) 记录 1 记录2 记录3 记录4 记录5 记录 6
File organization文件的逻辑组织 2、 The sequential file(顺序文件) fixed format used for records(统一记录结构) records are the same lengt all fields the same(order and length) field names and lengths are attributes of the file one field is the key filed(主键) uniquely identifies the record(唯一标识记录) records are stored in key sequence(按主键排序) new records are placed in a log file or transaction file(先临时放在 个日志文件中) batch update is performed to merge the log file with the master file (周期性地将日志文件中的内容并入主文件中) Record 2 Record 3
File Organization文件的逻辑组织 2、The Sequential File(顺序文件) – fixed format used for records(统一记录结构) – records are the same length – all fields the same (order and length) – field names and lengths are attributes of the file – one field is the key filed(主键) • uniquely identifies the record(唯一标识记录) • records are stored in key sequence(按主键排序) – new records are placed in a log file or transaction file(先临时放在一 个日志文件中) – batch update is performed to merge the log file with the master file (周期性地将日志文件中的内容并入主文件中) key1 key2 key3 Record 1 Record 2 Record 3
File organization文件的逻辑组织 3、 Indexed Sequential File(索引顺序文件) index provides a lookup capability to quickly reach the vicinity of the desired record(利用索引快速定位到记 录) contains key field and a pointer to the main file(索引表存放 个主键值及相应记录位置 index is searched to find highest key value that is equal or less than the desired key value(在索引表中找到最大的<=所要查 找的主键值的索引项) search continues in the main file at the location indicated by the pointer(从此处开始往下找)
File Organization文件的逻辑组织 3、Indexed Sequential File(索引顺序文件) – index provides a lookup capability to quickly reach the vicinity of the desired record(利用索引快速定位到记 录) • contains key field and a pointer to the main file(索引表存放 一个主键值及相应记录位置) • index is searched to find highest key value that is equal or less than the desired key value(在索引表中找到最大的<=所要查 找的主键值的索引项) • search continues in the main file at the location indicated by the pointer(从此处开始往下找)
File organization文件的逻辑组织 ◆ Indexed Sequential file(索引顺序文件) new records are added to an overflow file record in main file that precedes it is updated to contain a pointer to the new record the overflow is merged with the main file during a batch update multiple indexes for the same key field can be set up to increase efficiency Inde Main file Overflow file
File Organization文件的逻辑组织 Indexed Sequential File (索引顺序文件) – new records are added to an overflow file – record in main file that precedes it is updated to contain a pointer to the new record – the overflow is merged with the main file during a batch update – multiple indexes for the same key field can be set up to increase efficiency Index Levels 1 2 n Main File Overflow File