160 likes | 274 Views
CS 4432 Database Systems II Lecture 1: Introduction. A Brief Pre-amble. Relations. Statements. Results. Implementing a Database System? Simple?. Naïve Implementation. Relations stored in files (ASCII) e.g., relation Students is in /usr/db/Students. Students. Depts. Smith # 123 # CS
E N D
A Brief Pre-amble Notes 1
Relations Statements Results Implementing a Database System? Simple? Notes 1
Naïve Implementation • Relations stored in files (ASCII) e.g., relation Students is in /usr/db/Students Students Depts Smith # 123 # CS Jones # 522 # EE CS # Fuller Labs EE # Atwater Kent PH # Olin Hall . . . . Notes 1
Naïve Implementation Details • Directory file (ASCII) in /usr/db/schema Students#name#STR#id#INT#dept#STR Depts#name#STR#office#STR . . . Notes 1
Sample Query select Students.name,Depts.office from Students,Depts where Students.dept = Depts.name and Students.id > 300 # Smith # 123 # CS # CS # Fuller Labs Smith # 123 # CS # EE # Atwater Kent Smith # 123 # CS # PH # Olin Hall Jones # 522 # EE # CS # Fuller Labs Jones # 522 # EE # EE # Atwater Kent Jones # 522 # EE # PH # Olin Hall Notes 1
Simple Query Execution Process • To execute “select * from R where condition”: (1) Read dictionary to get R attributes (2) Read R file, for each line: (a) Check condition (b) If OK, display Notes 1
Yet Another Execution • To execute “select A,B from R,S where condition”: (1) Read dictionary to get Students and also Depts attributes (2) Read Students file, for each line: (a) Read Depts file, for each line: (i) Create join tuple (ii) Check condition (iii) Display if OK Notes 1
What’s wrong ? Notes 1
What’s wrong ? Layout ? • Tuple layout on disk • Example: - Change string from ‘Cat’ to ‘Cats’ and we have to rewrite file - ASCII storage is expensive - Deletions are expensive Notes 1
What’s wrong ? Search ? • Search expensive; no indexes e.g., - Cannot find tuple with given key quickly - Always have to read full relation Notes 1
What’s wrong ? • Brute force query processing e.g., select * from R,S where R.A = S.A and S.B > 1000 - Do select first? - More efficient join? Notes 1
What else is wrong ? Missing ? • No buffer manager : • Need caching • No concurrency control: • Multiple users access and modify same data ? • No reliability: • Lose data? leave operations half done ? • No security: • -File system insecure? Too coarse security? Notes 1
System Structure Strategy Selector Query Parser User User Transaction Transaction Manager Concurrency Control Buffer Manager Recovery Manager Lock Table File Manager M.M. Buffer Log Statistical Data Indexes User Data System Data Notes 1
Course Overview • File & System Structure Records in blocks, dictionary, buffer management,… • Indexing & Hashing B-Trees, hashing,… • Query Processing Query costs, join strategies,… • Crash Recovery Failures, stable storage,… • Concurrency Control Correctness, locks,… • Transaction Processing Logs, deadlocks,… • Additional Topics If time permits … Notes 1
Any Questions? Notes 1