Presentation is loading. Please wait.

Presentation is loading. Please wait.

Physical Database Design Chapter 5 G. Green 1. Agenda Purpose Activities Fields Records Files 2.

Similar presentations


Presentation on theme: "Physical Database Design Chapter 5 G. Green 1. Agenda Purpose Activities Fields Records Files 2."— Presentation transcript:

1 Physical Database Design Chapter 5 G. Green 1

2 Agenda Purpose Activities Fields Records Files 2

3 Purpose Determine physical specifications for data Goal: Processing Efficiency Performance Integrity Security Recoverability 3

4 Physical Design Activities Choose DBMS Detailed definitions for: fields (data dictionary) records (physical record structure, quantity ) files (access methods, space requirements) Physical File Creation Query Optimization 4

5 Physical Design Activities Choose DBMS Choose DBMS Detailed definitions for: fields (data dictionary) records(physical record structure) files (access methods) 5

6 Choosing a DBMS NOTE: This diagram is for effect ONLY—it is incomplete (e.g., no MDDB, no ODDB) AND contains some inaccuracies G. Green 6

7 Choosing a DBMS, cont… Compatibility with existing hardware, software, network, operating system DBMS features meet requirements*  Needed functionality  Structure of data  Nature of Workload Product reliability Vendor support IT personnel expertise Pricing, licensing 7

8 Physical Design Activities Choose DBMS Detailed definitions for: fields (data dictionary) fields (data dictionary) records(physical record structure) files (access methods) 8

9 Designing Fields Choose data types and lengths Represent all possible values Ensure data integrity Support data manipulations Minimize storage space Data integrity controls: defaults ranges nulls referential integrity Document above in data dictionarydata dictionary see Table 1-1 see Table 4-1 9

10 Designing Fields, cont… Text Char vs. Varchar/NVarchar Numbers Int vs. Decimal (or Numeric) Dates Date vs. Time vs. Datetime Others (will not use in class) 10

11 Physical Design Activities Choose DBMS Detailed definitions for: fields (data dictionary) records (physical record structure) records (physical record structure) files (access methods) 11

12 Designing Records, cont... Re-design options include: Denormalization What? When? Why? Why not? Partitioning Horizontal (row) Vertical (column) 12

13 13 Usage Analysis Example

14 14 Extra table access required Duplicate descriptions possible Denormalization Example

15 Physical Design Activities Choose DBMS Detailed definitions for: fields (data dictionary) records (physical record structure) files (access methods) files (access methods) 15

16 Designing Files Efficient access to data Efficient access to data  File Organizations  sequential  indexed  hashed Efficient storage of data  How much storage? 16

17 Sequential File Organization Records physically ordered  often by PK Examples Advantages Disadvantages 17

18 Indexed File Organization Data Records physically ordered Index Records give physical location of each data record indexes are separate files Advantages Disadvantages Example 18

19 Sequential File Organization 19 Page size = 1Kb 10,000 records Data record size =.5Kb  1K/.5K = 2 data records/page 20% = type E  10,000*.2 = 2,000 type E records “Find all 2,000 products that are type E” How many total “reads”?  10,000/2 = 5,000 No Index PRODUCT Table

20 Indexed File Organization, cont... 20 Page size = 1Kb 10,000 records Data record size =.5Kb  1K/.5K = 2 data records/page 20% = type E  10,000*.2 = 2,000 type E records Index record size = 5 bytes  1 byte for TYPE  4 bytes for ADDR 1,000b/5b = 200 index records/page “Find all 2,000 products that are type E” How many index “reads”?  10,000/200 = 50 How many data “reads”?  2,000 How many total “reads”?  2,000 + 50 = 2,050 With Index PRODUCT Table PROD_TYPE Index

21 Indexed File Organization, cont... Types of Indexes Primary Key Index  only ONE Secondary (Key) Indexes How to choose? Clustered Index How to structure indexes? B-Tree Bitmap … 21

22 B-Tree Index Organization 22 Root Leaf Branch rowid See http://www.ovaistariq.net/733/understanding-btree-indexes-and-how-they-impact-performance/ for more informationhttp://www.ovaistariq.net/733/understanding-btree-indexes-and-how-they-impact-performance/

23 Summary Purpose Activities Choose DBMS Fields Data dictionary Data types Records Usage Denormalization Files Organizations Indexing 23


Download ppt "Physical Database Design Chapter 5 G. Green 1. Agenda Purpose Activities Fields Records Files 2."

Similar presentations


Ads by Google