Download presentation
Presentation is loading. Please wait.
1
Spring 2003 ECE569 Lecture 04.1 ECE 569 Database System Engineering Spring 2003 Yanyong Zhang www.ece.rutgers.edu/~yyzhangwww.ece.rutgers.edu/~yyzhang Course URL www.ece.rutgers.edu/~yyzhang/spring03www.ece.rutgers.edu/~yyzhang/spring03
2
Spring 2003 ECE569 Lecture 04.2 An example query Query selectR.x, S.y, fromR,S whereR.k = S.f and R.b < 12; Read S sequentially, and for each tuple of S to read all relevant tuples of R.
3
Spring 2003 ECE569 Lecture 04.3 Scan A scan is a logical access path for the tuples in some relation R. It allows retrieval of tuples in a procedural fashion and in a sequence that depends on the definition of the logical access path. Whether this access path is supported at the physical layer by an index or by some other kind of storage structure is irrelevant.
4
Spring 2003 ECE569 Lecture 04.4 The definition of a scan Relation name Order Criterion Key : it could be either a subset of relation attributes, or a system-internal attribute reflecting the physical storage location of the tuple, such as tid. Range Condition Filter Isolation criterion
5
Spring 2003 ECE569 Lecture 04.5 Operations on a scan open_scan next_tuple is used to retrieve the next tuple in the scan. The current tuple (this is the one the scan pointer points to) can be modified or deleted.
6
Spring 2003 ECE569 Lecture 04.6 Different File Organizations File Unstructured (System Sequenced) Structure d Associative Non- Associative Keyed Clustered HashEntry Sequenced Relative
7
Spring 2003 ECE569 Lecture 04.7 Entry-sequenced files Tuples are appended to the file. A sequential file that reflects the order in which the tuples arrived. e.g., log files
8
Spring 2003 ECE569 Lecture 04.8 Entry-sequenced files operations insert l Free space is handled by a free space cursor, which at any instant is the end-of-file pointer. l If the last page cannot accommodate the tuple, a new empty page is claimed. update. An update cannot increase the tuple size. Delete. Free space cannot be reclaimed.
9
Spring 2003 ECE569 Lecture 04.9 System-sequenced files The tuple-oriented file system has complete control over where the tuples are stored. Additional information such as insert order is not maintained. Tuples are inserted wherever the free space administration points. Space freed by deleted tuples can be reclaimed either directly or after reorganization.
10
Spring 2003 ECE569 Lecture 04.10 System-sequenced files operations insert. The place for a new tuple is determined by the tuple-oriented space allocation. update. If the tuple length changes: l The tuple stays in its old page l The tuple must be moved to another page, but it has to be completely removed from its current page. delete.
11
Spring 2003 ECE569 Lecture 04.11 Relative Files Relative files are arrays of tuples. The file is pre-formatted l Contiguous pages l Fixed size tuples. header empty slot 6283
12
Spring 2003 ECE569 Lecture 04.12 Relative files operations insert. insert at, insert near, insert at end, insert anywhere update. Tuples can be updated arbitrarily as long as the resulting length is smaller than the maximum size. delete. The directory entry pertaining to the slot to be set to 0.
13
Spring 2003 ECE569 Lecture 04.13 Key-Sequenced and Hash Files Associative access is characterized by the mapping: tuple.attribute value(s) -> location in file. Implies a mapping from attribute value(s) to the TID. Fast access to each tuple.
14
Spring 2003 ECE569 Lecture 04.14 Key-sequenced and hash files operations insert. Upon insert, the mapping function is applied; it yields the page number, and sometimes the offset with the page. readkey. Given the key value, it returns the tuple. update. Tuples can be updated arbitrarily. If the key value is to be modified, it may be deleted from the current page, and move to the new page. delete.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.