1 Chapter 14 DML Tuning. 2 DML Performance Fundamentals DML Performance is affected by: – Efficiency of WHERE clause – Amount of index maintenance – Referential.

Slides:



Advertisements
Similar presentations
Tuning: overview Rewrite SQL (Leccotech)Leccotech Create Index Redefine Main memory structures (SGA in Oracle) Change the Block Size Materialized Views,
Advertisements

1 Constraints, Triggers and Active Databases Chapter 9.
Virtual training week 4 structured query language (SQL)
Loading & organising data. Objectives Loading data using direct-load insert Loading data into oracle tables using SQL*Loader conventional and direct paths.
9 Copyright © 2004, Oracle. All rights reserved. Managing Data.
Acknowledgments Byron Bush, Scott S. Hilpert and Lee, JeongKyu
Introduction to Structured Query Language (SQL)
Fundamentals, Design, and Implementation, 9/e Chapter 11 Managing Databases with SQL Server 2000.
1 - Oracle Server Architecture Overview
Harvard University Oracle Database Administration Session 2 System Level.
Introduction to Structured Query Language (SQL)
Chapter 5 Data Manipulation and Transaction Control Oracle 10g: SQL
Oracle9i Database Administrator: Implementation and Administration
SQL Basics. SQL SQL (Structured Query Language) is a special-purpose programming language designed from managing data in relational database management.
IT The Relational DBMS Section 06. Relational Database Theory Physical Database Design.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
Database Technical Session By: Prof. Adarsh Patel.
1 Oracle Database 11g – Flashback Data Archive. 2 Data History and Retention Data retention and change control requirements are growing Regulatory oversight.
By Lecturer / Aisha Dawood 1.  You can control the number of dispatcher processes in the instance. Unlike the number of shared servers, the number of.
Physical Database Design & Performance. Optimizing for Query Performance For DBs with high retrieval traffic as compared to maintenance traffic, optimizing.
© 2007 by Prentice Hall (Hoffer, Prescott & McFadden) 1 Introduction to SQL.
An Oracle server:  Is a database management system that provides an open, comprehensive, integrated approach to information management.  Consists.
Database structure and space Management. Database Structure An ORACLE database has both a physical and logical structure. By separating physical and logical.
1 Chapter 10 Joins and Subqueries. 2 Joins & Subqueries Joins – Methods to combine data from multiple tables – Optimizer information can be limited based.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Transactions and Locks A Quick Reference and Summary BIT 275.
7 Copyright © 2005, Oracle. All rights reserved. Managing Undo Data.
Database structure and space Management. Segments The level of logical database storage above an extent is called a segment. A segment is a set of extents.
1 Chapter 17 Shared Memory Contention. 2 Overview Specifically talking about SGA – Buffer Cache – Redo Log Buffer Contention in these areas of SGA – Can.
Database Lab Lecture 1. Database Languages Data definition language ( DDL ) Data definition language –defines data types and the relationships among them.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI
PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming Chapter 9 Database Triggers.
Database Programming Sections 11 & 12 –Sequences, Indexes, and Synonymns.
D Copyright © Oracle Corporation, All rights reserved. Loading Data into a Database.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 (Part II) INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor.
1 Chapter 13 Parallel SQL. 2 Understanding Parallel SQL Enables a SQL statement to be: – Split into multiple threads – Each thread processed simultaneously.
Partition Architecture Yeon JongHeum
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.
1 Chapter 9 Tuning Table Access. 2 Overview Improve performance of access to single table Explain access methods – Full Table Scan – Index – Partition-level.
Relational Database Management System(RDBMS) Structured Query Language(SQL)
IMS 4212: Constraints & Triggers 1 Dr. Lawrence West, Management Dept., University of Central Florida Stored Procedures in SQL Server.
Oracle 10g Database Administrator: Implementation and Administration Chapter 10 Basic Data Management.
7 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel 7.6 Advanced Select Queries SQL provides useful functions that.
Best Practices in Loading Large Datasets Asanka Padmakumara (BSc,MCTS) SQL Server Sri Lanka User Group Meeting Oct 2013.
Database Systems, 8 th Edition SQL Performance Tuning Evaluated from client perspective –Most current relational DBMSs perform automatic query optimization.
1 11g NEW FEATURES ByVIJAY. 2 AGENDA  RESULT CACHE  INVISIBLE INDEXES  READ ONLY TABLES  DDL WAIT OPTION  ADDING COLUMN TO A TABLE WITH DEFAULT VALUE.
CSC314 DAY 8 Introduction to SQL 1. Chapter 6 © 2013 Pearson Education, Inc. Publishing as Prentice Hall SQL OVERVIEW  Structured Query Language  The.
1 Database Fundamentals Introduction to SQL. 2 SQL Overview Structured Query Language The standard for relational database management systems (RDBMS)
SQL Triggers, Functions & Stored Procedures Programming Operations.
SQL Basics Review Reviewing what we’ve learned so far…….
Oracle 11g: SQL Chapter 5 Data Manipulation and Transaction Control.
Oracle sql Online Training By SMART MIND ONLINE TRAINING Website:
11 Copyright © 2009, Oracle. All rights reserved. Enhancing ETL Performance.
Active Database Concepts
Oracle9i Database Administrator: Implementation and Administration
The Basics of Data Manipulation
Chapter 4 Indexes.
CH 4 Indexes.
A Guide to SQL, Eighth Edition
CH 4 Indexes.
Oracle9i Developer: PL/SQL Programming Chapter 8 Database Triggers.
Chapter 11 Managing Databases with SQL Server 2000
Prof. Arfaoui. COM390 Chapter 9
Chapter 5 The Redo Log Files.
SQL Views Presented by: Dr. Samir Tartir
An Overview of GoldenGate Replication
Responding to Data Manipulation Via Triggers
Presentation transcript:

1 Chapter 14 DML Tuning

2 DML Performance Fundamentals DML Performance is affected by: – Efficiency of WHERE clause – Amount of index maintenance – Referential integrity overhead – The overhead of using triggers

3 Index Overhead Indexes help SELECT performance Indexes affect DML performance – Indexes are updated with DML operations – Important to keep only needed and used indexes – Use care creating indexes on frequently updated columns – DELETE overhead on indexes usually higher than the delete of the data itself

4 Trigger Overhead Triggers are PL/SQL blocks that execute when specified DML operations occur Example of trigger affecting DML on the SALES table: – Used to derive a column value – On INSERT or UPDATE statement, calculates UNIT_PRICE as part of DML operation: CREATE TRIGGER sales_iu_trg BEFORE INSERT OR UPDATE ON SALES FOR EACH ROW WHEN (new.quantity_sold > 0) BEGIN :new.unit_price := :new.amount_sold/:new.quantity_cold; END; In Oracle 11g, virtual columns can perform same functionality without trigger overhead

5 Referential Integrity Ensures data integrity Performance impacts with INSERTs and UPDATEs Slows down DML processing – Checks needed to ensure data integrity is maintained – Foreign keys created between tables to ensure this integrity

6 INSERT Optimization Array Processing – Especially valuable for INSERT statements – Improves bulk insert performance Direct Path Inserts – Conventional Path uses existing blocks with space for new rows Blocks processed in the buffer cache – Direct Path Writes new rows using new blocks directly to database files on disk Bypasses buffer cache Minimal redo log entries generated Reduces overhead of buffer cache management Invoked by APPEND hint and with SQL Loader If disk IO is system bottleneck, can actually be slower

7 Multi-Table Inserts Efficient if source table contains data to be applied to multiple target tables INSERT ALL WHEN region = ‘EMEA’ THEN INTO sales_emea (PROD_ID, CUST_ID, TIME_ID, CHANNEL_ID, PROMO_ID, QUANTITY_SOLD, AMOUNT_SOLD) VALUES (PROD_ID, CUST_ID, TIME_ID, CHANNEL_ID, PROMO_ID, QUANTITY_SOLD, AMOUNT_SOLD) WHEN region = ‘US’ THEN INTO sales_us (PROD_ID, CUST_ID, TIME_ID, CHANNEL_ID, PROMO_ID, QUANTITY_SOLD, AMOUNT_SOLD) VALUES (PROD_ID, CUST_ID, TIME_ID, CHANNEL_ID, PROMO_ID, QUANTITY_SOLD, AMOUNT_SOLD) SELECT * FROM sales_updates;

8 Delete Operations Delete is single most expensive operation – Needs to find row to be deleted – Removed row from data block – Update all indexes that reference the row – Checking referential integrity constraints – Processing related triggers – Creating UNDO entries for all of the above

9 Truncate Used to efficiently delete all rows from a table Resets table high water mark Improves subsequent full table scans Is a DDL operation, not a DML operation Cannot be rolled back Should be used over DELETE when removing all rows from a table

10 Partitions Can perform table-level operations at the partition-level – Can drop partitions to delete data – Can truncate partitions to delete data Use range or interval partitioning on date columns for data to be purged

11 Create Table as Select Can be used instead of delete if large number of rows need deletion Especially effective with the following clauses – NOLOGGING – PARALLEL Can be done using direct-path insert mode

12 Update and Merge Operations UPDATE changed values to existing rows – Correlated updates Use Join technique over correlated updates MERGE – Updates rows if they exist – Inserts new rows where there is no match – More efficient that separate UPDATE and INSERT statements

13 COMMIT Optimization COMMIT involves disk IO – More frequent COMMIT means more disk IO COMMIT – Usually driven by application design – Not by performance considerations – Data integrity more important than performance For bulk updates, COMMIT infrequently

14 Batch and NOWAIT COMMIT By default, COMMIT – Writes redo log entries to disk – Ensures recoverability and ACID qualities – Returns control to application after redo IO complete This can be modified for performance – COMMIT NOWAIT returns control to application immediately – Redo IO occurs in background – Raises possibility that Redo IO could fail unnoticed

15 NOLOGGING Reduces most redo log overhead incurred by DML Compromises recoverability Use NOLOGGING for tables that contain – Short term data – Non-critical data Use NOLOGGING in these operations – Create table as select – Create index – Direct path insert Append hint SQL Loader

16 Batch and NOWAIT COMMIT (cont.) This can be modified for performance (cont.) – COMMIT BATCH means Redo IO occurs “later” Reduced redo IO rate Opens chance that committed transaction not written to disk – Oracle 11 parameters can be set for all transactions COMMIT_LOGGING=BATCH COMMIT_WAIT=NOWAIT – Oracle 11g has single parameter COMMIT_WRITE={WAIT,NOWAIT,BATCH,IMMEDIATE} – See table 14-1 p. 455