Presentation is loading. Please wait.

Presentation is loading. Please wait.

CCT395, Week 11 Review, Permissions Physical Storage and Performance This presentation is licensed under Creative Commons Attribution License, v. 3.0.

Similar presentations


Presentation on theme: "CCT395, Week 11 Review, Permissions Physical Storage and Performance This presentation is licensed under Creative Commons Attribution License, v. 3.0."— Presentation transcript:

1 CCT395, Week 11 Review, Permissions Physical Storage and Performance This presentation is licensed under Creative Commons Attribution License, v. 3.0. To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/. This presentation incorporates images from the Crystal Clear icon collection by Everaldo Coelho, available under LGPL from http://everaldo.com/crystal/. Yuri Takhteyev University of Toronto November 17, 2010

2 The Exam 25%: ER + Normalization 50%: Fill-in-the-blanks SQL 25%: Conceptual questions

3 Estate ------------- name description Variety ------------- name description Region ------------- name description Shipment ------------- quantity date ordered Request ------------- quantity date Harvest ------------- year notes

4 select superhero.name from superhero join _____________________________________ on _____________________________________ where _______________________!="Lex Luthor" __________________ by ____________________

5 Conceptual questions - Main ideas - Things from the last 5 weeks (check the updated outline)

6 Questions?

7 João's Coffee

8 Divide and Conquer Getting the customers the right coffee - Ordering the right coffee - Delivering the coffee to the right customers

9 Estate ------------- name description Variety ------------- name description Region ------------- name description Shipment ------------- quantity date ordered Request ------------- quantity date Harvest ------------- year notes Coffee House ------------- address Shipper ------------- name telephone status? Invoice ------------- date amount? price?

10 SQL create table harvest ( harvest_id int, variety_id int, foreign key (variety_id) references variety(variety_id), estate_id int, foreign key (estate_id) references estate(estate_id), year year, notes varchar(200), primary key (harvest_id), );

11 Storage Persistent storage usually a harddrive(s) Challenges finding a representation not losing information storage space performance

12 CSV simple! relatively small but what to do with NULLs? and how would it perform?

13 CSV 657807938,559562982,223.47 755280276,889208095,590.32 934625720,459538801,344.66 852067113,660539228,684.77 + another billion rows How do we add a row? How do we delete a row? How do we find a row?

14 What if we sort it? 755280270,989809237,910.21 755280276,889208095,590.32 755280276,889909232,293.12 755280281,198234234,120.56 755280291,782737671,123.23 Finding is easier! But adding is harder...

15 And the second field? 479837218,889208091,345.29 755280276,889208095,590.32 879873454,889208098,938.29 767983465,889208101,389.02 574983342,889208121,291.73 Essentially an index. Easier to find, more stuff to store, more work to insert.

16 Trees 0123456789 0123456789 755280276,889208095,590.32 and other items that start with 75 (does not need to be ordered)

17 Fixed vs Dynamic ISAM: The structure is fixed B+ trees: The structure changes A: 4% O: <0.5% M: 9.5%

18 CCT395, Week 9 Review, Permissions Physical Storage and Performance This presentation is licensed under Creative Commons Attribution License, v. 3.0. To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/. This presentation incorporates images from the Crystal Clear icon collection by Everaldo Coelho, available under LGPL from http://everaldo.com/crystal/. Yuri Takhteyev University of Toronto November 17, 2010

19 The Exam 25%: ER + Normalization 50%: Fill-in-the-blanks SQL 25%: Conceptual questions

20 Estate ------------- name description Variety ------------- name description Region ------------- name description Shipment ------------- quantity date ordered Request ------------- quantity date Harvest ------------- year notes

21 select superhero.name from superhero join _____________________________________ on _____________________________________ where _______________________!="Lex Luthor" __________________ by ____________________

22 Conceptual questions - Main ideas - Things from the last 5 weeks (check the updated outline)

23 Questions?

24 João's Coffee

25 Divide and Conquer Getting the customers the right coffee - Ordering the right coffee - Delivering the coffee to the right customers

26 Estate ------------- name description Variety ------------- name description Region ------------- name description Shipment ------------- quantity date ordered Request ------------- quantity date Harvest ------------- year notes Coffee House ------------- address Shipper ------------- name telephone status? Invoice ------------- date amount? price?

27 SQL create table harvest ( harvest_id int, variety_id int, foreign key (variety_id) references variety(variety_id), estate_id int, foreign key (estate_id) references estate(estate_id), year year, notes varchar(200), primary key (harvest_id), );

28 Storage Persistent storage usually a harddrive(s) Challenges finding a representation not losing information storage space performance

29 CSV simple! relatively small but what to do with NULLs? and how would it perform?

30 CSV 657807938,559562982,23.47 755280276,889208095,590.32 934625720,459538801,44.66 852067113,660539228,1684.77 + another billion rows

31 CSV 657807938,559562982,23.47 755280276,889208095,590.32 934625720,459538801,44.66 852067113,660539228,1684.77 + another billion rows

32 CSV 657807938,559562982,23. 47755280276,889208095,590.32934625720,4595 38801,44.66852067113, 660539228,1684.77.....

33 Fixed-Length 657807938559562982002347 755280276889208095059032 934625720459538801004466 852067113660539228168477 + another billion rows start of Nth row = N * length of row

34 CSV 657807938,559562982,23.47 755280276,889208095,590.32 934625720,459538801,44.66 852067113,660539228,1684.77 + another billion rows How do we add a row? How do we delete a row? How do we find a row?

35 What if we sort it? 755280270,989809237,10.21 755280276,889208095,590.32 755280276,889909232,293.12 755280281,198234234,3120.56 755280291,782737671,13.23 Finding is easier! But adding is harder...

36 And the second field? 479837218,889208091,12345.29 755280276,889208095,590.32 879873454,889208098,38.29 767983465,889208101,9.02 574983342,889208121,1.73 Essentially an index. Easier to find, more stuff to store, more work to insert.

37 Trees 0123456789 0123456789 755280276,889208095,590.32 and other items that start with 75 (does not need to be ordered)

38 Fixed vs Balanced Fixed: E.g., ISAM Balanced: E.g., B+ Trees A: 4% M: 9.5% Q: 0

39 Balanced Tree Antonov Zhang Aaronson O'Neil Thomson Silva Peters Zhukov Kim

40 Balanced Tree Antonov Aaronson O'Neil Thomson Silva Peters Zhukov Kim Zhang

41 Balanced Tree Antonov Aaronson O'Neil Thomson Silva Peters Zhukov Kim Zhang

42 Balanced Tree Antonov Aaronson O'Neil Thomson Silva Peters Zhukov Kim Zhang

43 Balanced Tree Antonov Aaronson O'Neil Thomson Silva Peters Zhukov Kim Zhang

44 Balanced Tree Antonov Aaronson O'Neil Thomson PetersZhukov Kim Zhang Silva

45 Balanced Tree Antonov Aaronson O'Neil Thomson PetersZhukov Kim Zhang Silva

46 Balanced Tree Antonov Aaronson O'Neil Thomson PetersZhukov Kim Zhang Silva

47 Balanced Tree Antonov Aaronson O'Neil Thomson PetersZhukov Kim Zhang Silva

48 Balanced Tree Antonov Aaronson O'Neil Thomson Peters ZhukovKim Zhang Silva

49 Storage Engines CVS yes, it's an option MyISAM the default relatively simple See: /var/lib/mysql/menagerie/ InnoDB more features

50 Storage Engines CVS yes, it's an option MyISAM the default relatively simple InnoDB more features

51 Storage Engines CVS yes, it's an option MyISAM the default relatively simple InnoDB more features

52 The Extra Features Foreign Key Constraints no, not in MyISAM! Transactions start transaction; update table1...; update table2...; commit; Downside: complexity

53 More Engines Memory no harddrive → faster Blackhole doesn't actually store anything Federated allows remote tables Etc.

54 Picking an Engine create table superhero ( id integer, primary key (id), name char(100) ) engine=InnoDB;

55 Index Easy retrieval by field - usually automatic for PK - optional for other fields create index name_index on superhero(name);

56 to be continued


Download ppt "CCT395, Week 11 Review, Permissions Physical Storage and Performance This presentation is licensed under Creative Commons Attribution License, v. 3.0."

Similar presentations


Ads by Google