1 Further Experiences of Global Temporary Tables in Oracle 8.1 David Kurtz Go-Faster Consultancy Ltd.

Slides:



Advertisements
Similar presentations
What the Search Engines are up to Now: same ingredients different recipes Karen Blakeman RBA Information Services, UK 02 June 20141Karen Blakeman
Advertisements

PeopleSoft Ping David Kurtz
Tuning a Very Large Data Warehouse Pichai Bala. About Me Working in the IT industry for the past 17 years Working in Oracle since Working in Data.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
13 Copyright © 2005, Oracle. All rights reserved. Monitoring and Improving Performance.
Rollback Segments Nilendu Misra (MAR99)
11 Copyright © Oracle Corporation, All rights reserved. Managing Tables.
Go-Faster Consultancy Ltd.1 Experiences of Global Temporary Tables in Oracle 8.1 David Kurtz Go-Faster Consultancy Ltd.
The Architecture of Oracle
Creating Tables. 2 home back first prev next last What Will I Learn? List and provide an example of each of the number, character, and date data types.
UKOUG DBMS SIG www.go-faster.co.uk1 Materialized Views: Simple Replication? David Kurtz Go-Faster Consultancy Ltd.
Collaborate08 PeopleTools 8.48/9© PeopleTools 8.48/8.49 New Database Features David Kurtz Go-Faster Consultancy Ltd.
Global Payroll Performance Optimisation - I David Kurtz Go-Faster Consultancy Ltd.
Go-Faster Consultancy Ltd.1 Single Table Clusters, an alternative to partitioning? David Kurtz Go-Faster Consultancy Ltd.
PIA Load Balancing, JVMs and Garbage Collection David Kurtz Go-Faster Consultancy Ltd.
An introduction to SQL*Trace, TKPROF and Execution Plans
Manipulating Data Schedule: Timing Topic 60 minutes Lecture
Row Migration can Aggravate Contention on Cache Buffer Chains Latch David Kurtz Go-Faster Consultancy Ltd.
INTRODUCTION TO ORACLE DATABASE ADMINISTRATION Lynnwood Brown System Managers LLC Introduction – Lecture 1 Copyright System Managers LLC 2007 all rights.
A Guide to SQL, Seventh Edition. Objectives Create a new table from an existing table Change data using the UPDATE command Add new data using the INSERT.
1 - Oracle Server Architecture Overview
System Administration Accounts privileges, users and roles
Harvard University Oracle Database Administration Session 2 System Level.
Harvard University Oracle Database Administration Session 5 Data Storage.
Transaction Management WXES 2103 Database. Content What is transaction Transaction properties Transaction management with SQL Transaction log DBMS Transaction.
Backup and Recovery Part 1.
Troubleshooting SQL Server Enterprise Geodatabase Performance Issues
Practical Database Design and Tuning. Outline  Practical Database Design and Tuning Physical Database Design in Relational Databases An Overview of Database.
Database Administration TableSpace & Data File Management
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.
CSE 781 – DATABASE MANAGEMENT SYSTEMS Introduction To Oracle 10g Rajika Tandon.
Physical Database Design & Performance. Optimizing for Query Performance For DBs with high retrieval traffic as compared to maintenance traffic, optimizing.
Extents, segments and blocks in detail. Database structure Database Table spaces Segment Extent Oracle block O/S block Data file logical physical.
Database Systems Slide 1 Database Systems Lecture 5 Overview of Oracle Database Architecture - Concept Manual : Chapters 1,8 Lecturer : Dr Bela Stantic.
1 RAC Internals Julian Dyke Independent Consultant Web Version juliandyke.com © 2007 Julian Dyke.
7202ICT – Database Administration
Oracle Tuning Ashok Kapur Hawkeye Technology, Inc.
Deleting LOTS of Data Author: Randy Cunningham, OCP.
1 Chapter 14 DML Tuning. 2 DML Performance Fundamentals DML Performance is affected by: – Efficiency of WHERE clause – Amount of index maintenance – Referential.
DBMS Implementation Chapter 6.4 V3.0 Napier University Dr Gordon Russell.
1 CS 430 Database Theory Winter 2005 Lecture 16: Inside a DBMS.
Database Design and Management CPTG /23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,
Objectives After completing this lesson, you should be able to do the following: Describe each data manipulation language (DML) statement Insert rows.
Database structure and space Management. Database Structure An ORACLE database has both a physical and logical structure. By separating physical and logical.
Introduction to Oracle. Oracle History 1979 Oracle Release client/server relational database 1989 Oracle Oracle 8 (object relational) 1999.
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. When things go wrong: how to find SQL error Sveta Smirnova Principle Technical Support Engineer, Oracle.
D Copyright © Oracle Corporation, All rights reserved. Loading Data into a Database.
Process Architecture Process Architecture - A portion of a program that can run independently of and concurrently with other portions of the program. Some.
Oracle 10g Database Administrator: Implementation and Administration Chapter 5 Basic Storage Concepts and Settings.
Chapter 1Oracle9i DBA II: Backup/Recovery and Network Administration 1 Chapter 1 Backup and Recovery Overview MSCD642 Backup and Recovery.
Chapter 5 Index and Clustering
Transactions, Roles & Privileges Oracle and ANSI Standard SQL Lecture 11.
Learningcomputer.com SQL Server 2008 –Views, Functions and Stored Procedures.
A Guide to SQL, Eighth Edition Chapter Six Updating Data.
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.
IT Database Administration Section 05. Rollback Segments: An Introduction  What are they?  Space within a database used to store “before” images.
Aggregator Stage : Definition : Aggregator classifies data rows from a single input link into groups and calculates totals or other aggregate functions.
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.
 CONACT UC:  Magnific training   
Data, Space and Transaction Processing
How To Pass Oracle 1z0-060 Exam In First Attempt?
Database structure and space Management
Introduction of Week 3 Assignment Discussion
Practical Database Design and Tuning
Oracle Memory Internals
Presentation transcript:

1 Further Experiences of Global Temporary Tables in Oracle 8.1 David Kurtz Go-Faster Consultancy Ltd.

2 Further Experiences of Global Temporary Tables Who am I? What are they? Where did we use them? Why did we want to use them? What benefits did they bring? What were the pitfalls? When could GTTs to improve performance?

Resources If you cant hear me say so now. Please feel free to ask questions as we go along. The presentation is available from –Including files for demo –article from Oracle Scene magazine

Who am I? DBA –Independent consultant –Performance tuning PeopleSoft –UKOUG Unix SIG

What are GT Tables? Permanent objects Content is temporary and private –Session –Transaction No physical attributes –physical, but transient, existence in temporary segment Greatly reduced redo logging

Permanent Object Create table statement You can specify –Constraints –Index –Triggers [1.sql]

… but not that permanent You cannot specify –Tablespace tablespace_name is null on user_tables –Storage clause values are null on user_tables –Physical attributes but there are default values [2.sql]

Data is transient Two forms of GT table: –Delete on commit (default) Data cleared at end of transaction –Preserve on commit Data cleared at end of session [3.sql]

Data is private to a session You cannot see data in the same global temporary table that was created by another session. Therefore you cannot pass data between processes via a GT table Unique constraints enforced per table [3b.sql]

Statistics on Oracle 8i You can analyze –Implied commit removes data in on commit delete rows GT table –But it doesnt do any good –Any statistics gathered are not retained. You cant gather_stats Temporary Segment overhead –Sizing [4.sql]

Statistics on Oracle 9i ON COMMIT PRESERVE GT table –Analyse/Gather statistics collects statistics for current sessions version of table –Only one place for statistics for all session –Same statistics for all sessions –So when should you collect statistics, and based upon what data?

sys.dbms_statistics Import previously gathered statistics –run process on normal table –gather statistics –export statistics –recreate table as GT table –import statistics [4b.sql]

Quirks Cant drop (or perform any DDL on) GT table if you or anyone else has used it [5.sql] –Cant populate a table and then add an index. –Can Create Table as Select –Cant add index later to an on preserve commit –Unique Constraint in CTAS on preserve commit appears to have a problem.

Another Quirk You must not set your default tablespace to a temporary tablespace –if you do you cannot create indexes on global temporary tables –ORA Attempt to create PERMANENT object in a TEMPORARY tables

Yet Another Quirk Try to create GTT as an ORGANIZATION INDEX –ORA-14458: attempt was made to create a temporary table with INDEX organization Thanks to Julian Dyke

Yet More Quirks In and 9.2 can't create a partitioned GTT (why would anyone want to?). In and 9.2 can create bitmap, reverse, compressed, function based, descending and nosegment indexes on GTTs In 9.2 you can't compress a global temporary table (data segment compression) Thanks to Julian Dyke

Bug TRUNCATE with REUSE STORAGE option has no effect on a PRESERVE ON COMMIT global temporary table –Oracle 8i (not tested in 9) Works properly without REUSE STORAGE! [6.sql]

Benefits Reduction in redo logging –Still some logging for undo information No High Water Marks to worry about –Tables are scanned up to the high water mark –Batch processes often use permanent tables used for temporary storage –Large batch runs raise high water marks

Benefits Elimination of Consistent Reads on working storage tables during parallel processing –Many instances of same process Not Parallel Query, nor Parallel Server (nka. RAC) –Each process writes rows to same working storage table –GT guarantees that one block is only updated by one process

How much redo is saved? First Experiment –Two tables A normal table and a GT table no indexes 1 character column –Insert different numbers of rows –Insert different lengths of data –Measure redo (v$sysstat)

How much redo is saved? Second experiment –A normal table similar to payroll result tables 0, 1, 2 indexes Insert 1000, 10000, rows into it Measure redo (v$sysstat) –Repeat with GT tables

40%-50% saving in redo

Case Study 1 Old Swiss payroll system –33000 employees –Complex calculation 890 values / employee / month retained –values appear on pay slip or statutory reporting –intermediate values –iterative calculations –Retrospective

Why did we use GT tables? Massive Redo logging volume –24Gb/hr 20 x 500Mb redo logs backup strategy? Archive log writer falling behind, all redo logs requiring archiving

Where does the redo logging come from? Lots of values calculated –inserted into tables Drop/Truncate Bug –Base Bug (internal) Oracle calls kcbcxx() repeatedly. Debug function to make sure no buffers in cache for particular range. Scan time increases with SGA size. Fixed

How many values are calculated? –120 values / employee / month retained Writes 4.5M values (that are retained) –1 permanent result table (2 indexes, was 3) –1 balance table (1 index, will be 2) –770 intermediate values / employee / month Writes 28.5M values (that are discarded) –6 temporary result tables (2 indexes each, was 3) –40 million rows on balance table –(after 9 months)

How is payroll calculated? There are 2 ways to do payroll –Process employees sequentially Calculate each rule for each employee –Set processing Rule A+B=C INSERT INTO C(EMPNO, VALUE) SELECT E.EMPNO, A.VALUE+B.VALUE,... FROM tableA, tableB, elig E WHERE A.EMPNO = E.EMPNO AND B.EMPNO = E.EMPNO

Background Employee population broken into subsets –14 arbitrary groups (~2700 employees / group) –14 independent processes running in parallel Rule based payroll Too late to change the design Oracle Range Partitioning not effective –Frequent year to date queries

Background Indexing exhausted Requirement to keep 18 months data Retrospective nature of payroll 48 x 500Mb redo log switches per hour

How did we use GT tables? Converted calculation result tables to GT –Process commits between rules –Temporary (calculation step) result tables Delete on commit Commit flushes temporary result tables between payroll rules –Temporary rule result table Preserve on commit Copied to balance tables at end of calculation for each month

What benefits did GT tables bring? Greatly reduced redo logging (60%) –40% less logging on GT tables themselves –Reduced scanning because GT kept small by delete on commit between rules Does not force use of Cost Based Optimiser –(July 1999, Oracle 8.0.6, we needed CBO)

60% reduction in redo logging, 55% reduction in execution time

Case Study 2 New Swiss Payroll Project –Same company –33000 employees –Sequential Cobol calculation process –Multiple parallel calculation processes Each Process handles range of EMPLID 30 streams Oracle with CBO

Issues ORA-1555 on working storage tables –30 Processes updating different rows potentially in the same data block –Up to 30 copies of some data blocks in buffer cache –Huge rollback segment I/O

Solution All Working storage tables made GT –Each session has its own physical version of each working storage table –1 version of each block in buffer cache –No consistent reads

Range Partitioning Also range partitioned result tables –Physical partition ranges correspond to logical processing ranges –1 processing stream: 1 range partition –Each data block only updated by one and only one process –No consistent reads –Improved data scans within process

Quirk Oracle Fixed in –On at least HP-UX and AIX Queries joining two GT tables and a partitioned table Intermittent Partition elimination problem Possible Oracle bug

Case Study 3 Financials Batch Processing –Introduction of GT tables initially increased execution times –Different execution plans Added specific hints Faked statistics

Benefits of GT Table Reduction in Redo –If poorly designed application Avoidance of Consistent Read –Can help avoid ORA-1555 –Stability High Water Marks Minimal Code Change

Pitfalls of GT tables CBO Statistics require special handling –Import Statistics with dbms_stats package –Need to use hints Process not restartable –Feature of application that process can be restarted at last commit prior to a crash –But, GT result tables cleared out at end of session

What kind of process is suitable for GT tables? Batch/single threaded processes Temporary work tables –Typically keyed by a process instance –No problem clearing out debris left by failure –Removes the problem of HWM on temp tables extending after an abnormally large run (which typically happens after a failure when the backlog has to be cleared)

What is not suitable? Application server processes –In some application servers different requests in same business transaction might be handled by any one of a number of server processes. –Data is local to session Inter-process communication –Data is local to session

Final Comments I probably wouldnt use GT tables if designing a system from scratch. –Better not to store transient data in the database in the first place. Useful feature if it is too late to change the design –Packaged Application

Any Questions?

Advertisment Packaged Application Tuning –Hall 8b –3.55pm

Where is the big white table? Server Technology Panel Session –11.55am in Hall 8b

48 Further Experiences of Global Temporary Tables in Oracle 8.1 David Kurtz Go-Faster Consultancy Ltd.