University of Sunderland COM 220 Lecture Ten Slide 1 Database Performance.

Slides:



Advertisements
Similar presentations
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Advertisements

PowerPoint Presentation for Dennis & Haley Wixom, Systems Analysis and Design Copyright 2000 © John Wiley & Sons, Inc. All rights reserved. Slide 1 Key.
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.
IS 4420 Database Fundamentals Chapter 6: Physical Database Design and Performance Leon Chen.
Data Indexing Herbert A. Evans. Purposes of Data Indexing What is Data Indexing? Why is it important?
Physical Database Monitoring and Tuning the Operational System.
PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 © John Wiley & Sons, Inc. All rights reserved. Slide 1.
PowerPoint Presentation for Dennis & Haley Wixom, Systems Analysis and Design Copyright 2000 © John Wiley & Sons, Inc. All rights reserved. Slide 1 Data.
Chapter 17 Methodology – Physical Database Design for Relational Databases Transparencies © Pearson Education Limited 1995, 2005.
Team Dosen UMN Physical DB Design Connolly Book Chapter 18.
Data at the Core of the Enterprise. Objectives  Define of database systems.  Introduce data modeling and SQL.  Discuss emerging requirements of database.
Systems analysis and design, 6th edition Dennis, wixom, and roth
Practical Database Design and Tuning. Outline  Practical Database Design and Tuning Physical Database Design in Relational Databases An Overview of Database.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Database Performance Tuning and Query Optimization.
IT The Relational DBMS Section 06. Relational Database Theory Physical Database Design.
Lecture 8 Index Organized Tables Clusters Index compression
1 © Prentice Hall, 2002 Physical Database Design Dr. Bijoy Bordoloi.
Lecture 9 Methodology – Physical Database Design for Relational Databases.
PowerPoint Presentation for Dennis & Haley Wixom, Systems Analysis and Design, 2 nd Edition Copyright 2003 © John Wiley & Sons, Inc. All rights reserved.
University of Sunderland COM 220 Lecture Three Slide 1 Database Application Lifecycle.
TM 7-1 Copyright © 1999 Addison Wesley Longman, Inc. Physical Database Design.
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.
University of Sunderland COM 220Lecture Two Slide 1 Database Theory.
PowerPoint Presentation for Dennis & Haley Wixom, Systems Analysis and Design Copyright 2000 © John Wiley & Sons, Inc. All rights reserved. Slide 1 Systems.
Normalization (Codd, 1972) Practical Information For Real World Database Design.
Chapter 6 1 © Prentice Hall, 2002 The Physical Design Stage of SDLC (figures 2.4, 2.5 revisited) Project Identification and Selection Project Initiation.
SQL Server Indexes Indexes. Overview Indexes are used to help speed search results in a database. A careful use of indexes can greatly improve search.
© Pearson Education Limited, Chapter 15 Physical Database Design – Step 7 (Consider Introduction of Controlled Redundancy) Transparencies.
Chapter 6 Database Administration
DBMS Implementation Chapter 6.4 V3.0 Napier University Dr Gordon Russell.
Chapter 16 Practical Database Design and Tuning Copyright © 2004 Pearson Education, Inc.
Object Persistence (Data Base) Design Chapter 13.
External data structures
Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.
Slide 1 Object Persistence Design Chapter 13 Alan Dennis, Barbara Wixom, and David Tegarden John Wiley & Sons, Inc. Slides by Fred Niederman Edited by.
1 CS 430 Database Theory Winter 2005 Lecture 16: Inside a DBMS.
© 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.
Database Management COP4540, SCS, FIU Physical Database Design (ch. 16 & ch. 3)
Methodology – Physical Database Design for Relational Databases.
Indexes and Views Unit 7.
University of Sunderland COM 220 Lecture Seven Slide 1 Database Users & Administration.
SQL/Lesson 7/Slide 1 of 32 Implementing Indexes Objectives In this lesson, you will learn to: * Create a clustered index * Create a nonclustered index.
Physical Database Design Purpose- translate the logical description of data into the technical specifications for storing and retrieving data Goal - create.
Lec 7 Practical Database Design and Tuning Copyright © 2004 Pearson Education, Inc.
Chapter 5 Index and Clustering
Session 1 Module 1: Introduction to Data Integrity
Chapter 4 Indexes. Indexes Logically represents subsets of data from one or more tables View Generates numeric valuesSequence Basic unit of storage; composed.
Creating Indexes on Tables An index provides quick access to data in a table, based on the values in specified columns. A table can have more than one.
Chapter 3: Relational Databases
1 Indexes ► Sort data logically to improve the speed of searching and sorting operations. ► Provide rapid retrieval of specified rows from the table without.
Database Systems, 8 th Edition SQL Performance Tuning Evaluated from client perspective –Most current relational DBMSs perform automatic query optimization.
Oracle Announced New In- Memory Database G1 Emre Eftelioglu, Fen Liu [09/27/13] 1 [1]
SQL IMPLEMENTATION & ADMINISTRATION Indexing & Views.
Practical Database Design and Tuning
Indexes By Adrienne Watt.
Physical Database Design and Performance
Methodology – Physical Database Design for Relational Databases
Physical Database Design for Relational Databases Step 3 – Step 8
CHAPTER 5: PHYSICAL DATABASE DESIGN AND PERFORMANCE
國立臺北科技大學 課程:資料庫系統 fall Chapter 18
Physical Database Design
Practical Database Design and Tuning
Chapter 4 Indexes.
CH 4 Indexes.
CH 4 Indexes.
The Physical Design Stage of SDLC (figures 2.4, 2.5 revisited)
Presentation transcript:

University of Sunderland COM 220 Lecture Ten Slide 1 Database Performance

University of Sunderland COM 220 Lecture Ten Slide 2 Database Performance Perfomance can be improved through: Denormalisation Optimisation of SQL Indexes Clusters

University of Sunderland COM 220 Lecture Ten Slide 3 Database Performance DENORMALISATION Normalisation improves the logical database design and prevents anomalies BUT –More tables more joins –Joining > 3 tables is likely to be slow Denormalisation reverses normalisation for efficiency purposes

University of Sunderland COM 220 Lecture Ten Slide 4 Database Performance Select * from...; DBMS DATA FILES SQL OPTIMISATION

University of Sunderland COM 220 Lecture Ten Slide 5 Database Performance INDEXES An index is a table or some other data structure that is used to determine the location of a row within a table that satisfies some condition. Indexes may be defined on both primary and non key attributes.

University of Sunderland COM 220 Lecture Ten Slide 6 Database Performance INDEXES oracle allows faster access on any named table by using an index. each row within a table is given a unique value or rowid. each rowid can be held in an index. an index can be created at any time. any column within a table can be indexed.

University of Sunderland COM 220 Lecture Ten Slide 7 Database Performance WHEN TO CREATE AN INDEX Before any input of data for Unique index After data input for Non-unique index

University of Sunderland COM 220 Lecture Ten Slide 8 Database Performance HOW DO YOU CREATE AN INDEX ? EXAMPLE :- (a) CREATE INDEX TENIDX ON TENANT(SURNAME); (b) CREATE UNIQUE INDEX TENIDX ON TENANT(SURNAME);

University of Sunderland COM 220 Lecture Ten Slide 9 Database Performance GUIDELINES FOR USE OF INDEXES > 200 rows in a table a column is frequently used in a where clause specific columns are frequently used as join columns

University of Sunderland COM 220 Lecture Ten Slide 10 Database Performance POINTS TO WATCH avoid if possible > 3 indexes on any one table avoid indexing a column with too few distinct values For example:- male/female avoid indexing a column with too many distinct values avoid if > 15% of rows will be retrieved

University of Sunderland COM 220 Lecture Ten Slide 11 Database Performance CLUSTERS A disk is arranged in blocks Blocks are retrieved as a whole and buffered Disk Access time is slow compared with Memory access Gains can be made if the number of block transfers can be reduced

University of Sunderland COM 220 Lecture Ten Slide 12 Database Performance CLUSTERING clusters physically arrange the data on disk so that frequently retrieved info is stored together allows 2 or more tables to be stored in the same physical block can greatly reduce access time for join operations. can also reduce storage space requirements.

University of Sunderland COM 220 Lecture Ten Slide 13 Database Performance CLUSTER DEFINITION clustering is transparent to the user no queries have to be modified no applications need to be changed tables are queried in the same way whether clustered or not

University of Sunderland COM 220 Lecture Ten Slide 14 Database Performance DECIDING WHERE TO USE CLUSTERS Each table can only reside in 1 cluster At least one attribute in the cluster must be NOT NULL Consider the query transactions in the system –How often is the query submitted –How time critical is the query –What’s the amount of data retrieved

University of Sunderland COM 220 Lecture Ten Slide 15 Database Performance HOW TO CREATE A CLUSTER Step 1 create cluster tenpay(tenid char(8)); Step 2 alter cluster tenpay add table tenant where tenpay.tenid = tenant.property_id; Step 3 alter cluster tenpay add table payment where tenpay.tenid = payment.payment_id

University of Sunderland COM 220 Lecture Ten Slide 16 Database Performance CLUSTERING EXERCISE STOCK WAREHOUSE PRODUCT

University of Sunderland COM 220 Lecture Ten Slide 17 Database Performance To speed up access time to data in these three tables (WAREHOUSE, PRODUCT, STOCK) it is necessary to cluster either STOCK around WAREHOUSE, or STOCK around PRODUCT. How do we decide which will be the most efficient? For the purpose of this exercise we will assume that each block can hold 100 records.

University of Sunderland COM 220 Lecture Ten Slide 18 Database Performance If STOCK is clustered around PRODUCT No of products = There will be 1 record for each PRODUCT in each WAREHOUSE. Therefore each product would have 3 records Each block would contain 100/3 products, i.e. 33 products. There would therefore be a 1 in 3 chance of accessing a particular stock item by reading one block of data.

University of Sunderland COM 220 Lecture Ten Slide 19 Database Performance If STOCK is clustered around WAREHOUSE No of warehouses = _____. There will be ____ record for each item of STOCK in each warehouse. Therefore each warehouse would have ______ records. The records for each warehouse would have to be stored across ______ blocks. Access would therefore be faster if STOCK is clustered around the product.

University of Sunderland COM 220 Lecture Ten Slide 20 Database Performance OPTIMIZING PERFORMANCE Performance can be regarded as a balancing act between:- –access performance –update performance –ease of use/modification

University of Sunderland COM 220 Lecture Ten Slide 21 Further Reading Query Optimisation –Connolly & Begg, 3 rd edition, chapter 20 –Connolly & Begg, 4 th edition, chapter 21 Performance Tuning (including denormalisation) –Connolly & Begg, 3 rd edition, chapter 17 –Connolly & Begg, 4 th edition, chapter 18 Next Week –HCI