Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
14 views17 pages

Storage Page Example

The document describes different page formats and examples of operations on a movie star database page. It shows: 1) A fixed length record page format with fields for name, address, gender, and birthday. A movie star record takes up 296 bytes. 2) Examples of inserting, deleting, and retrieving records on a page. Inserting Jackie changes the record count, and deleting Tom changes the ID of the remaining record. 3) A variable length record page stores the record length and a pointer to the start of each record. Inserting and deleting changes the pointers but not the IDs.

Uploaded by

chungjerry94
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views17 pages

Storage Page Example

The document describes different page formats and examples of operations on a movie star database page. It shows: 1) A fixed length record page format with fields for name, address, gender, and birthday. A movie star record takes up 296 bytes. 2) Examples of inserting, deleting, and retrieving records on a page. Inserting Jackie changes the record count, and deleting Tom changes the ID of the remaining record. 3) A variable length record page stores the record length and a pointer to the start of each record. Inserting and deleting changes the pointers but not the IDs.

Uploaded by

chungjerry94
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Page Format

Example

1
Example of Page Formats
 Assume page size = 4KB
 Perform the following operations on Page K
in order
 Insert Jackie, Tom, Jet
 Delete Tom
 Retrieve Jet

Name Address Gender Birthday


Jackie Chan … M 07/04/1954
Jet Li … M 26/04/1963
Tom Cruise … M 03/07/1962

2
Example: Fixed Length Records
 Example MovieStar relation
 name: char(30)
 address: char(255)
 gender: 1 byte
 birthday: 10 bytes
 Record of type MovieStar will take
30 + 255 + 1 + 10 = 296 bytes
gender birthdate

name address
Field offset 0 30 285 286 296
3
Alt 1: Before Insertion

4
Alt 1: After Inserting Jackie
Jackie Chan … M …

5
Alt 1: After Inserting Tom, Jet
Jackie Chan … M …
Tom Cruise … M …
Jet Li … M …

6
Alt 1: After Deleting Tom
Jackie Chan … M …
Jet Li … M …

Record id of “Jet” changed!


7
Alt 2: Before Insertion

0 0 0 0 0 0 0 0 0 0 0 0 0 13

8
After Inserting Jackie
Jackie Chan … M …

0 0 0 0 0 0 0 0 0 0 0 0 1 13

9
After Inserting Tom, Jet
Jackie Chan … M …
Tom Cruise … M …
Jet Li … M …

0 0 0 0 0 0 0 0 0 0 1 1 1 13

10
After Deleting Tom
Jackie Chan … M …

Jet Li … M …

0 0 0 0 0 0 0 0 0 0 1 0 1 13

Record id of “Jet” unchanged!


11
Example: Variable Length Record
 The MovieStar relation
 name: variable length
 address: variable length
 gender: 1 byte
 birthday: 10 bytes
record pointer to
length address

name address

gender birthdate

12
Before Insertion

0 0 0 0 0 0 0 0 0 0 0 0 0 13
0

13
After Inserting Jackie
100 22 M … Jackie Chan …

0 0 0 0 0 0 0 0 0 00, 100 13
0 0 01 100

14
After Inserting Tom, Jet
100 22 M … Jackie Chan … 113 21 M ..
. Tom Cruise … 106 17 M … Jet Li .
..

0 0 0 213,
0 0106
0 100,
0 0113 13
0 0 03 319
0 00, 100

15
After Deleting Tom
100 22 M … Jackie Chan …
106 17 M … Jet Li .
..

0 0 0 213, 0 0 -1,0 00 00, 100


0 0106 13
0 0 03 319

Record id of “Jet” unchanged!


16
More Operations
 How about moving “Jet” on the page?

 How about further inserting the following record?

120 ? M … Kin-Leung Tsui …

17

You might also like