Notes03 - Topics for today CS 245: Database System...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
1 CS 245 Notes 3 1 CS 245: Database System Principles Notes 03: Disk Organization Hector Garcia-Molina CS 245 Notes 3 2 • How to lay out data on disk • How to move it to memory Topics for today CS 245 Notes 3 3 What are the data items we want to store? •a sa la ry name da te p ic tu re CS 245 Notes 3 4 What are the data items we want to store? p What we have available: Bytes 8 bits CS 245 Notes 3 5 To represent: • Integer (short): 2 bytes e.g., 35 is 00000000 00100011 • Real, floating point n bits for mantissa, m for exponent…. CS 245 Notes 3 6 •Cha rac rs various coding schemes suggested, most popular is ascii To represent: Example: A: 1000001 a: 1100001 5: 0110101 LF: 0001010
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 CS 245 Notes 3 7 • Boolean e.g., TRUE FALSE 1111 1111 0000 0000 To represent: • Application specific e.g., RED 1 GREEN 3 BLUE 2 YELLOW 4 CS 245 Notes 3 8 • Boolean e.g., TRUE FALSE 1111 1111 0000 0000 To represent: • Application specific e.g., RED 1 GREEN 3 BLUE 2 YELLOW 4 Can we use less than 1 byte/code? Yes, but only if desperate. .. CS 245 Notes 3 9 •Da tes e.g.: - Integer, # days since Jan 1, 1900 - 8 characters, YYYYMMDD - 7 characters, YYYYDDD (not YYMMDD! Why?) •T ime e.g. - Integer, seconds since midnight - characters, HHMMSSFF To represent: CS 245 Notes 3 10 • String of characters – Null terminated e.g., – Length given e.g., -F ixedlength c t a c t a 3 To represent: CS 245 Notes 3 11 •Bag o f b i ts Length Bits To represent: CS 245 Notes 3 12 Key Point • Fixed length items • Variable length items - usually length given at beginning
Background image of page 2
3 CS 245 Notes 3 13 • Type of an item: Tells us how to interpret (plus size if fixed) Also CS 245 Notes 3 14 Data Items Records Blocks Files Memory Overview CS 245 Notes 3 15 Record - Collection of related data items (called FIELDS) E.g.: Employee record: name field, salary field, date-of-hire field, . .. CS 245 Notes 3 16 Types of records: • Main choices: – FIXED vs VARIABLE FORMAT – FIXED vs VARIABLE LENGTH CS 245 Notes 3 17 A SCHEMA (not record) contains following information -#f ie lds - type of each field - order in record - meaning of each field Fixed format CS 245 Notes 3 18 Example: fixed format and length Employee record (1) E#, 2 byte integer (2) E.name, 10 char. Schema (3) Dept, 2 byte code 55 s m i t h 02 83 j o n e s 01 Records
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 CS 245 Notes 3 19 • Record itself contains format “Self Describing” Variable format CS 245 Notes 3 20 Example: variable format and length 4 I 5 24 SD R O F 46 Field name codes could also be strings, i.e. TAGS # Fields Code identifying field as E# Integer type Code for Ename String type Length of str. CS 245 Notes 3 21 Variable format useful for: • “sparse” records • repeating fields • evolving formats But may waste space. .. CS 245 Notes 3 22 • EXAMPLE: var format record with repeating fields Employee one or more children 3 E_name: Fred Child: Sally Child: Tom CS 245 Notes 3 23 Note: Repeating fields does not imply - variable format, nor -var iab le s ize John Sailing Chess -- CS 245 Notes 3 24 Note: Repeating fields does not imply - variable format, nor s John Sailing Chess -- • Key is to allocate maximum number of repeating fields (if not used null)
Background image of page 4
5
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 04/02/2012.

Page1 / 15

Notes03 - Topics for today CS 245: Database System...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online