1 / 33

Instructor

Instructor. 彭智勇 武汉大学软件工程国家重点实验室 电话 :87653196 Email: zypeng@public.wh.hb.cn. Book. 经典原版书库 《Database System Implementation》 (美) Hator Garcia-Molina, Jeffrey.D.Ullman, Jennifer Widom 著 ( 斯坦福大学 ) 机械工业出版社. Marking Scheme. Assignment (4) ( 练习 ,3 次 ): 15%

Télécharger la présentation

Instructor

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Instructor 彭智勇 武汉大学软件工程国家重点实验室 电话:87653196 Email: zypeng@public.wh.hb.cn

  2. Book 经典原版书库 《Database System Implementation》 (美)Hator Garcia-Molina, Jeffrey.D.Ullman, Jennifer Widom 著 (斯坦福大学) 机械工业出版社

  3. Marking Scheme • Assignment (4) (练习,3次): 15% • Small Test (3) (小测验,3次): 15% • Final Examination (期末考试): 70% • Total 100%

  4. Practice • 安装PostgreSQL系统 • 分析PostgreSQL源代码 • 改进PostgreSQL系统 http://www.postgresql.org

  5. Database System Implementation Hector Garcia-Molina Jeffrey D. Ullman Jennifer Widom

  6. Chapter 1 Introduction to DBMS Implementation

  7. Database Management System A database management system (DBMS) is a powerful tool for creating and managing large amounts of data efficiently and allowing it to persist over long periods of time, safely.

  8. Capabilities of a DBMS • Persistent Storage • Programming interface allowing the user to access and modify data through a powerful query language. • Transaction Management supporting concurrent access to data and resiliency ( i.e. recovering from failures or errors)

  9. Terminology Review • Data • Database A collection of data, well organized for access and modification, preserved over a long period. • Query • Relation An organization of data into a two-dimensional table. • Schema (Metadata) A description of the structure of the data.

  10. A Simple DBMS: Megatron 2000 Megatron 2000 is a relational database management system which supports the SQL query language.

  11. Megatron 2000 Implementation The Relation Students(name, id, dept) Data: /usr/db/students Smith#123#CS Johnson#522#EE …… Schema: /usr/db/schema Students#name#STR#id#INT#dept#STR Depts#name#STR#office#STR ……

  12. Execution of Megatron 2000 DBMS dbhost> megatron2000 WELCOME TO MEGATRON 2000 ! & SELECT * FROM Students # name id dept Smith 123 CS Johnson 522 EE

  13. & SELECT * FROM Students WHERE id>= 500 | HighID # /usr/db/HighID Johnson#522#EE

  14. How Megatron 2000 Executes Queries • SELECT * FROM R WHERE <Condition> • Read the file schema to determine the attributes of relation R and their types. • Check that the <Condition> is semantically valid for R. • Display each of the attribute names as the header of a column, and draw a line. • Read the file named R, and for each line: • (a) Check the condition, and • (b) Display the line as a tuple, if the condition is true.

  15. SELECT * FROM R WHERE <Condition> | T • Read the file schema to determine the attributes of relation R and their types. • Check that the <Condition> is semantically valid for R. • Read the file named R, and for each line: • (a) Check the condition, and • (b) Write the result to a new file /usr/db/T, if the condition is true. • 4. Add to the file /usr/db/schema an entry for T that looks just like the entry for R, except that relation name T replaces R. That is, the schema for T is the same as the schema for R.

  16. Example 1.2 SELECT office FROM Students, Depts WHERE Students.name = ‘Smith’ AND Students.dept = Depts.name # for (each tuple s in Students) for (each tuple d in Depts) if(s and d satisfy the WHERE-condition) display the office value from Depts;

  17. Problem (1) of Megatron 2000 Tuple layout on disk The data layout on disk is not flexible. e.g., - Change string from ‘Cat’ to ‘Cats’ and we have to rewrite file - ASCII storage is expensive - Deletions are expensive

  18. Problem (2) of Megatron 2000 Search expensive; no indexes e.g., - Cannot find tuple with given key quickly - Always have to read full relation

  19. Problem (3) of Megatron 2000 Brute force query processing Query-processing is not clever. e.g., select * from R,S where R.A = S.A and S.B > 1000 - Do select first? - More efficient join?

  20. Problem (4) of Megatron 2000 • No buffer manager • There is no buffer in main memory. • e.g., Need caching

  21. Problem (5) of Megatron 2000 There is no concurrency control.

  22. Problem (6) of Megatron 2000 • No reliability • e.g., - Can lose data • - Can leave operations half done

  23. Problem (7) of Megatron 2000 No security e.g., - File system insecure - File system security is coarse

  24. Problem (8) of Megatron 2000 • No application program interface (API) e.g., How can a payroll program get at the data?

  25. Problem (9) of Megatron 2000 • Cannot interact with other DBMSs.

  26. Problem (10) of Megatron 2000 • Poor dictionary facilities

  27. Problem (11) of Megatron 2000 • No GUI

  28. Overview of a Database Management System Database administrator User/application transaction commands queries, updates DDL Commands Query Compiler DDL Compiler Transaction Manager query plan metadata statistics metadata Execution engine Logging and Recovery Concurrency Control Index, file, and record requests Index/file/rec- Ord manager log pages page commands data, metadata, indexes Buffer manager Lock table read/write pages Storage manager Buffers Storage

  29. Storage Management It is responsible for storing data, metadata, indexes, and logs. An important storage management component is the buffer manager, which keeps portions of the data contents in main memory.

  30. Query Processing A user or an application program initiates query to extract data from the database. The query is parsed and optimized by a query compiler. The resulting query plan is executed by the execution engine.

  31. Transaction Management • Logging and Recovery • Concurrency Control • Deadlock Resolution

  32. Course Overview • Storage-Management Overview C2 Memory hierarchy C3 Storage of data elements C4 one-dimensional indexes C5 Multidimensional indexes • Query Processing C6 Query Execution C7 Query compiler and optimizer • Transaction-Processing C8 System failures C9 Concurrency control C10 More about transaction management • Information integration

  33. The course lets students know better ways of building a database management system.

More Related