Notes03 - CS 245: Database System Principles Notes 03: Disk...

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

View Full Document Right Arrow Icon
1 CS 245: Database System Principles CS 245 Notes 3 1 Notes 03: Disk Organization Hector Garcia-Molina • How to lay out data on disk • How to move it to memory Topics for today CS 245 Notes 3 2 What are the data items we want to store? •a sa la ry name da te •ap icture CS 245 Notes 3 3 • a picture What are the data items we want to store? ap CS 245 Notes 3 4 • a picture What we have available: Bytes 8 bits To represent: • Integer (short): 2 bytes e.g., 35 is 00000000 00100011 CS 245 Notes 3 5 • Real, floating point n bits for mantissa, m for exponent…. •Cha rac rs various coding schemes suggested, most popular is ascii To represent: CS 245 Notes 3 6 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 • Boolean e.g., TRUE FALSE 1111 1111 0000 0000 To represent: • Application specifi CS 245 Notes 3 7 • Application specific e.g., RED 1 GREEN 3 BLUE 2 YELLOW 4 • Boolean e.g., TRUE FALSE 1111 1111 0000 0000 To represent: • Application specifi CS 245 Notes 3 8 • 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. .. •Da tes e.g.: - Integer, # days since Jan 1, 1900 - 8 characters, YYYYMMDD - 7 characters, YYYYDDD To represent: CS 245 Notes 3 9 (not YYMMDD! Why?) •T ime e.g. - Integer, seconds since midnight - characters, HHMMSSFF • String of characters – Null terminated e.g., c t a To represent: CS 245 Notes 3 10 – Length given e.g., -F ixedlength c t a 3 •Bag o f b i ts Length Bits To represent: CS 245 Notes 3 11 Key Point • Fixed length items Variable length item CS 245 Notes 3 12 • Variable length items - usually length given at beginning
Background image of page 2
3 • Type of an item: Tells us how to interpret (plus size if fixed Also CS 245 Notes 3 13 (plus size if fixed) Data Items Records Blocks Overview CS 245 Notes 3 14 Files Memory Record - Collection of related data items (called FIELDS ) E.g.: Employee record: name field, salary field CS 245 Notes 3 15 salary field, date-of-hire field, . .. Types of records: • Main choices: – FIXED vs VARIABLE FORMAT – FIXED vs VARIABLE LENGTH CS 245 Notes 3 16 FIXED vs VARIABLE LENGTH A SCHEMA (not record) contains following information -# f ie lds tf h f i l d Fixed format CS 245 Notes 3 17 - type of each field - order in record - meaning of each field Example: fixed format and length Employee record (1) E#, 2 byte integer (2) E.name, 10 char. Schema CS 245 Notes 3 18 (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 • Record itself contains format “Self Describing” Variable format CS 245 Notes 3 19 Example: variable format and length 4 I 5 24 SD R O F 46 elds tifying E# pe name e str. CS 245 Notes 3 20 Field name codes could also be strings, i.e. TAGS # Fie Code ident field as Integer ty p Code for E String type Length of Variable format useful for: • “sparse” records • repeating fields • evolving formats CS 245 Notes 3 21 But may waste space. ..
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 15

Notes03 - CS 245: Database System Principles Notes 03: Disk...

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

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