Physical Database Design

Slides:



Advertisements
Similar presentations
Chapter 18 Methodology – Monitoring and Tuning the Operational System Transparencies © Pearson Education Limited 1995, 2005.
Advertisements

1 Pertemuan > > Matakuliah: >/ > Tahun: > Versi: >
Logical Database Design
Database Systems: A Practical Approach to Design, Implementation and Management International Computer Science S. Carolyn Begg, Thomas Connolly Lecture.
Chapter Physical Database Design Methodology Software & Hardware Mapping Logical Design to DBMS Physical Implementation Security Implementation Monitoring.
Chapter 6 Methodology Conceptual Databases Design Transparencies © Pearson Education Limited 1995, 2005.
Physical Database Monitoring and Tuning the Operational System.
1 Methodology : Conceptual Databases Design © Pearson Education Limited 1995, 2005.
Lecture Fourteen Methodology - Conceptual Database Design
Database Systems: A Practical Approach to Design, Implementation and Management International Computer Science S. Carolyn Begg, Thomas Connolly Lecture.
Methodology Conceptual Database Design
Modeling & Designing the Database
Chapter 17 Methodology – Physical Database Design for Relational Databases Transparencies © Pearson Education Limited 1995, 2005.
© Pearson Education Limited, Chapter 12 Physical Database Design – Step 3 (Translate Logical Design) Transparencies.
LOGICAL DATABASE DESIGN
Team Dosen UMN Physical DB Design Connolly Book Chapter 18.
Chapter 14 & 15 Conceptual & Logical Database Design Methodology
Overview of the Database Development Process
Relational Model & Relational Algebra. 2 Relational Model u Terminology of relational model. u How tables are used to represent data. u Connection between.
Chapters 17 & 18 Physical Database Design Methodology.
Practical Database Design and Tuning. Outline  Practical Database Design and Tuning Physical Database Design in Relational Databases An Overview of Database.
CSC271 Database Systems Lecture # 30.
ITEC224 Database Programming
Lecture 9 Methodology – Physical Database Design for Relational Databases.
Chapter 16 Methodology - Conceptual Database Design.
1 Introduction to Database Systems. 2 Database and Database System / A database is a shared collection of logically related data designed to meet the.
Methodology - Conceptual Database Design Transparencies
Software School of Hunan University Database Systems Design Part III Section 5 Design Methodology.
Methodology Conceptual Databases Design
9/14/2012ISC329 Isabelle Bichindaritz1 Database System Life Cycle.
1 Chapter 15 Methodology Conceptual Databases Design Transparencies Last Updated: April 2011 By M. Arief
Physical Database Design Chapter 6. Physical Design and implementation 1.Translate global logical data model for target DBMS  1.1Design base relations.
Chapter 16 Methodology – Physical Database Design for Relational Databases.
CSC271 Database Systems Lecture # 29. Summary: Previous Lecture  The normalization process  1NF, 2NF, 3NF  Inference rules for FDs  BCNF.
1 Index Structures. 2 Chapter : Objectives Types of Single-level Ordered Indexes Primary Indexes Clustering Indexes Secondary Indexes Multilevel Indexes.
Methodology - Conceptual Database Design. 2 Design Methodology u Structured approach that uses procedures, techniques, tools, and documentation aids to.
Chapter 9 Methodology - Logical Database Design Chapter 16 in Textbook.
CSCI 3140 Module 3 – Logical Database Design for the Relational Model Theodore Chiasson Dalhousie University.
1/26/2004TCSS545A Isabelle Bichindaritz1 Database Management Systems Design Methodology.
Methodology: Conceptual Databases Design
DATABASE MGMT SYSTEM (BCS 1423) Chapter 5: Methodology – Conceptual Database Design.
Team Dosen UMN Database Design Connolly Book Chapter
© Pearson Education Limited, Chapter 9 Logical database design – Step 1 Transparencies.
Conceptual Database Design
© Pearson Education Limited, Chapter 13 Physical Database Design – Step 4 (Choose File Organizations and Indexes) Transparencies.
10/10/2012ISC239 Isabelle Bichindaritz1 Physical Database Design.
Physical Database Design Transparencies. ©Pearson Education 2009 Chapter 11 - Objectives Purpose of physical database design. How to map the logical database.
Chapter 8 Methodology - Conceptual Database Design Chapter 15 in Textbook.
Methodology - Conceptual Database Design
Part4 Methodology of Database Design Chapter 07- Overview of Conceptual Database Design Lu Wei College of Software and Microelectronics Northwestern Polytechnical.
1 Chapter 17 Methodology - Local Logical Database Design.
Methodology – Physical Database Design for Relational Databases.
Chapter 9 Logical Database Design : Mapping ER Model To Tables.
Sekolah Tinggi Ilmu Statistik (STIS). Main Topics Denormalizing and introducing controlled redundancy  Meaning of denormalization.  When to denormalize.
Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware.
B. Information Technology (Hons.) CMPB245: Database Design Physical Design.
10/3/2017 Chapter 6 Index Structures.
Methodology Conceptual Databases Design
Indexes By Adrienne Watt.
Record Storage, File Organization, and Indexes
Methodology Conceptual Database Design
Methodology – Physical Database Design for Relational Databases
Methodology – Monitoring and Tuning the Operational System
Physical Database Design for Relational Databases Step 3 – Step 8
國立臺北科技大學 課程:資料庫系統 fall Chapter 18
Conceptual Database Design
Logical Database Design
Methodology – Monitoring and Tuning the Operational System
Methodology Conceptual Databases Design
Presentation transcript:

Physical Database Design Chapter 10 Methodology - Physical Database Design Chapter 18, Appendix F in Textbook

Design Methodology Review A structured approach that uses procedures, techniques, tools, and documentation aids to support and facilitate the process of design. Conceptual DB Design

Database Design Review Hardware independent Software independent Conceptual DB design Hardware independent Software dependent Logical DB design Hardware dependent Software dependent Physical DB design Physical DB Design

Design Methodology Overview Review Step 1 Build local conceptual data model for each user view. Step 2 Build and validate local logical data model for each view. Step 3 Build and validate global logical data model. Step 4 Translate global logical data model for target DBMS. Step 5 Design physical representation. Step 6 Design user views. Step 7 Design security mechanisms. Step 8 Consider the introduction of controlled redundancy. Step 9 Monitor and tune the operational system. Physical DB Design

Comparison of Logical and Physical Database Design Logical database design is concerned with the what, Physical database design is concerned with the how. Process of producing a description of the implementation of the database on secondary storage; it describes the base relations, file organizations, and indexes used to achieve efficient access to the data, and any associated integrity constraints and security measures. Physical DB Design

Overview of Physical Database Design Methodology Step 4 Translate global logical data model for target DBMS Step 4.1 Design base relations Step 4.2 Design representation of derived data Step 4.3 Design enterprise constraints Step 5 Design physical representation Step 5.1 Analyze transactions Step 5.2 Choose file organizations Step 5.3 Choose indexes Step 5.4 Estimate disk space requirements Physical DB Design

Overview of Physical Database Design Methodology Step 6 Design user views Step 7 Design security mechanisms Step 8 Consider the introduction of controlled redundancy Step 9 Monitor and tune the operational system Physical DB Design

Step 4 Translate Global Logical Data Model for Target DBMS Objective: To produce a relational database schema that can be implemented in the target DBMS from the global logical data model. Need to know functionality of target DBMS such as how to create base relations and whether the system supports the definition of: PKs, FKs, and AKs; required data (NOT NULL); domains; relational integrity constraints; enterprise constraints. Physical DB Design

Step 4.1 Design Base Relations Objective: To decide how to represent base relations identified in global logical model in target DBMS. For each relation, need to define: the name of the relation; a list of simple attributes in brackets; the PK and, where appropriate, AKs and FKs. a list of any derived attributes and how they should be computed; referential integrity constraints for any FKs identified. Physical DB Design

Step 4.1 Design Base Relations For each attribute, need to define: its domain, consisting of a data type, length, and any constraints on the domain; an optional default value for the attribute; whether the attribute can hold nulls. Physical DB Design

PropertyForRent Relation Domain PropertyNumber: variable length character string, length 5 Domain street: variable length character string, length 25 Domain city: variable length character string, length 15 : PROPERTYFORRENT( propertyNo PropertyNumber NOT NULL, Street street NOT NULL, City city NOY NULL, PRIMARY KEY(propertyNo), FOREIGN KEY (staffNo) REFERENCES staff(staffNO) ON UPDATE CASCADE ON DELETE SET NULL, FOREIGN KEY (ownerNo) REFERENCES POwner(ownerNO) ON UPDATE CASCADE ON DELETE SET NULL); Physical DB Design

Step 4.2 Design Representation of Derived Data Objective: To decide how to represent any derived data present in the global logical data model in the target DBMS. Derived attribute can be stored in database or calculated every time it is needed. Option selected is based on: additional cost to store the derived data and keep it consistent with operational data from which it is derived; cost to calculate it each time it is required. Physical DB Design

STAFF StaffNo FName LName BrnNo NoPro SL21 John White B005 SG37 Ann SG37 Ann Beech B003 2 SG14 David Ford B003 1 SA9 Mary Howe B007 1 SG5 Susan Brand B003 SL41 Julie Lee B005 1 Physical DB Design

Step 4.3 Design Enterprise Constraints Objective: To design the enterprise constraints for the target DBMS. Some DBMS provide more facilities than others for defining enterprise constraints. Example: CONSTRAINT StaffNotHandlingTooMuch CHECK (NOT EXISTS (SELECT staffNo FROM PropertyForRent GROUP BY staffNo HAVING COUNT(*) > 100)) Physical DB Design

Step 5 Design Physical Representation Objective: To determine optimal file organizations to store the base relations and the indexes that are required to achieve acceptable performance; that is, the way in which relations and tuples will be held on secondary storage. Physical DB Design

Step 5 Design Physical Representation Number of factors that may be used to measure efficiency: - Transaction throughput: number of transactions processed in given time interval. - Response time: elapsed time for completion of a single transaction. - Disk storage: amount of disk space required to store database files. However, no one factor is always correct. Typically, have to trade one factor off against another to achieve a reasonable balance. Physical DB Design

Step 5.1 Analyze Transactions Objective: To understand the functionality of the transactions that will run on the database and to analyze the important transactions. Attempt to identify performance criteria, such as: transactions that run frequently and will have a significant impact on performance; transactions that are critical to the business; times during the day/week when there will be a high demand made on the database (called the peak load). Physical DB Design

Step 5.1 Analyze Transactions Use this information to identify the parts of the database that may cause performance problems. To select appropriate file organizations and indexes, also need to know high-level functionality of the transactions, such as: attributes that are updated in an update transaction; criteria used to restrict tuples that are retrieved in a query. Often not possible to analyze all expected transactions, so investigate most ‘important’ ones. Physical DB Design

Step 5.1 Analyze Transactions To focus on areas that may be problematic: (1) Map all transaction paths to relations. (2) Determine which relations are most frequently accessed by transactions. (3) Analyze the data usage of selected transactions that involve these relations. Physical DB Design

Transaction’s Pathways for Global View StaffNo (b) SUPERVISOR STAFF register (0,*) (a) (0,100) (e) (d) manage OwnerNo PropertyNo VDate Comment (c,g) (0,1) (1:1) (1,*) (1,1) PROPERTY BOwn views CLIENT OWNER ClientNo (0,*) (0,*) (0,*) (h,i) (0,*) (1:1) associate hold d state (m) (l) PRIVATE OWNER BUSINESS OWNER (1:1) (j) (1:1) LEASE PREFERENCE LeaseNo (1:1) (k)

Transaction Usage Map has offer manage Avg = 20 Max= 40 (C) STAFF 2000 BRANCH 100 has Avg = 50 Max= 100 (E) (F) Avg = 1000 Max= 3000 (D) PROPERTY 100000 offer manage Physical DB Design

Transaction Analysis Form

Step 5.2 Choose File Organizations Objective: To determine an efficient file organization for each base relation. File organizations include: Heap (unordered) Ordered Hash Indexed Sequential Access Method (ISAM) B+-Tree Physical DB Design

Indexes A data structure that allows the DBMS to locate particular records in a file more quickly and thereby speed response to user queries. Types of Indexes: Primary Index: the data file is sequentially ordered by an ordering key field, and the indexing field is built on the ordering key field (unique). Clustering Index: the data file is sequentially ordered on a non-key field (not distinct), and the indexing field is built on this non-key field (clustering attribute). Secondary Index: an index that is defined on a non-ordering field of the data file (distinct or not). A file can have at most 1 primary index or clustering index, and several secondary indexes.

Index Example STAFF (brnNo) Data File Index File SG14 John White 18000 B005 B003 SG37 Ann Beech 12000 B003 B003 SL21 David Ford 30000 B003 B005 SL41 Mary B007 Howe 9000 B007 Data File Index File Of any file organization ordered Physical DB Design

Primary Index Example page 1 2 3 Anchor record index Data file S5 1 S5 Record S9 Record S14 Record S21 Record S37 Record S41 Record Physical DB Design

Cluster Index Example page 1 2 3 index Data file S5 1 S5 Record S14 2 Physical DB Design

Indexes STAFF (salary, brnNo) (salary) StaffNo FName LName Salary SG14 John White 18000 B005 9000 12000,B003 SG37 Ann Beech 12000 B003 12000 18000,B005 SL21 David Ford 30000 B003 18000 30000,B003 SL41 Mary B007 Howe 9000 30000 Physical DB Design

Index Categories page 1 2 3 page 1 2 3 index Data file S5 1 S9 1 S14 2 S5 Record S9 Record S14 Record S21 Record S37 Record S41 Record Dense index index Data file page 1 2 3 S5 1 S14 2 S37 3 S5 Record S9 Record S14 Record S21 Record S37 Record S41 Record Sparse index Physical DB Design

Multilevel Index page 1 2 3 4 Level 1 Index Data file Level 2 Index S5 S5 Record S9 Record S14 Record S21 Record S37 Record S41 Record S56 Record S87 Record S5 S37 S37 S56 Physical DB Design

Step 5.3 Choose Indexes Objective: To determine whether adding indexes will improve the performance of the system. Two approaches: Keep tuples unordered and create many secondary indexes. Order tuples in the relation by specifying a primary or clustering index. Choose the attribute for ordering the tuples as: attribute that is used most often for join operations. attribute that is used most often to access the tuples in a relation in order of that attribute. Example: CREATE UNIQUE INDEX PropertyNoInd ON PropertyForRent(PNo); CREATE INDEX StaffNoInd ON PropertyForRent(StaffNo) CLUSTER;

Choose Secondary Indexes Overhead involved in maintenance and use of secondary indexes that has to be balanced against performance improvement gained when retrieving data. This includes: adding an index record to every secondary index whenever tuple is inserted; updating a secondary index when corresponding tuple is updated; increase in disk space needed to store the secondary index. Physical DB Design

Guidelines for Choosing Indexes (1) Do not index small relations. (2) Index PK of a relation if it is not a key of the file organization. (3) Add secondary index to a FK if it is frequently accessed. (4) Add secondary index to any attribute that is heavily used as a secondary key. (5) Add secondary index on attributes that are involved in: selection or join criteria; ORDER BY; GROUP BY; and other operations involving sorting (such as UNION or DISTINCT). Physical DB Design

Guidelines for Choosing Indexes (6) Add secondary index on attributes involved in built-in functions. SELECT branchNo, AVG(salary) FROM Staff GROUP BY branchNo; (7) Add secondary index on attributes that could result in an index-only plan. (8) Avoid indexing an attribute or relation that is frequently updated. (9) Avoid indexing an attribute if the query will retrieve a significant proportion of the tuples in the relation. (10) Avoid indexing attributes that consist of long character strings. Physical DB Design

Additional Indexes Table Index Staff FName, LName SupervisorStaffNo Position Client StaffNo FName, LName PropertyForRent OwnerNo StaffNo ClientNo RentFinish City Rent Viewing ClientNo Physical DB Design

Step 5.4 Estimate Disk Space Requirements Objective: To estimate the amount of disk space that will be required by the database. Estimating the disk usage is highly dependent on the target DBMS and hardware used to support the database. The estimate is based on: Size of each tuple. Maximum number of tuples in each relation (i.e. Consider how the relation will grow to estimate the Max potential size). Physical DB Design

Step 6 Design User Views Objective: To design the user views that were identified during the Requirements Collection and Analysis stage of the relational database application lifecycle. User view play a major role in enforcing security, especially in multi-user DBMS. The major advantages of user view: Data independence. Reduce complexity. Customization. Physical DB Design

Step 7 Design Security Measures Objective: To design the security measures for the database as specified by the users during the development life cycle. Relational DBMS provide two type of security: System Security: covers access and use of the database at the system level, such as user name and password. Data Security: covers access and use of database objects, such as a relation or view, and the action that users can have on that objects. Physical DB Design

Step 8 Consider the introduction of controlled redundancy Objective: To determine whether introducing redundancy in a controlled manner by relaxing the normalization rules will improve the performance of the system. This step should be undertaken only if necessary, because of the inherited problems involved in introducing redundancy while still maintaining consistency. Physical DB Design

Step 9 Monitor and tune the operational system Objective: To monitor the operational system and improve the performance of the system to correct inappropriate design decisions or reflect changing requirements. Its an ongoing process of monitoring the operational system. Physical DB Design