California State University Common Management Systems TUG Session: April 21, 2005 1 Overview Statistics in CMS PRD / Non-PRD Environments.

Slides:



Advertisements
Similar presentations
Copyright © SoftTree Technologies, Inc. DB Tuning Expert.
Advertisements

Module 13: Performance Tuning. Overview Performance tuning methodologies Instance level Database level Application level Overview of tools and techniques.
Introduction to ReportSmith and Effective Dated Tables
Module 17 Tracing Access to SQL Server 2008 R2. Module Overview Capturing Activity using SQL Server Profiler Improving Performance with the Database Engine.
INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC Performance And Tuning – Lecture 7 Copyright System Managers LLC 2007 all rights reserved.
Oracle9i Database Administrator: Implementation and Administration 1 Chapter 12 System and Object Privileges.
5 Copyright © Oracle Corporation, All rights reserved. Using Data Dictionary and Dynamic Performance Views.
12 Copyright © 2005, Oracle. All rights reserved. Proactive Maintenance.
Query Manager. QM is a collection of tools you can use to obtain information from the AS/400 database Used to –select, arrange, and analyze information.
1 How to improve SQL Performance with new Health Check Tool? Carlos Sierra Consulting Technical Advisor © 2012 Oracle Corporation – Proprietary and Confidential.
Oracle 10g Database Administrator: Implementation and Administration
1 Chapter Overview Transferring and Transforming Data Introducing Microsoft Data Transformation Services (DTS) Transferring and Transforming Data with.
Week 5 – Chap. 5 Data Transfer DBAs often must transfer data to and from text files, Excel spreadsheets, Access, Oracle or other SQL Server databases This.
1 Tuning PL/SQL procedures using DBMS_PROFILER 20-August 2009 Tim Gorman Evergreen Database Technologies, Inc. Northern California Oracle.
Module 9: Managing Schema Objects. Overview Naming guidelines for identifiers in schema object definitions Storage and structure of schema objects Implementing.
ORAMAIN Consulting Services, LLC1 The Do’s and Don’ts of CBO by Jim Gillespie ORAMAIN Consulting Services, LLC id: website:
12 Copyright © 2004, Oracle. All rights reserved. Automatic Management.
12 Copyright © 2007, Oracle. All rights reserved. Database Maintenance.
Database Design for DNN Developers Sebastian Leupold.
Optimizer Statistics Julian Dyke Independent Consultant Web Version
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
Oracle9i Database Administrator: Implementation and Administration 1 Chapter 9 Index Management.
CHAPTER 6 Users and Basic Security. Progression of Steps for Creating a Database Environment 1. Install Oracle database binaries (Chapter 1) 2. Create.
Week 6 Lecture 2 System and Object Privileges. Learning Objectives  Identify and manage system and object privileges  Grant and revoke privileges to.
Oracle Database Administration Lecture 6 Indexes, Optimizer, Hints.
Informix IDS Administration with the New Server Studio 4.0 By Lester Knutsen My experience with the beta of Server Studio and the new Informix database.
RBO RIP George Lumpkin Director Product Management Oracle Corporation Session id:
1 Chapter 7 Optimizing the Optimizer. 2 The Oracle Optimizer is… About query optimization Is a sophisticated set of algorithms Choosing the fastest approach.
1 What’s Up with dbms_stats? Terry Sutton Database Specialists, Inc.
Triggers A Quick Reference and Summary BIT 275. Triggers SQL code permits you to access only one table for an INSERT, UPDATE, or DELETE statement. The.
Oracle and Infrastructure Expertise Optimal Usage of Oracle’s Partitioning Option Frank Bommarito Paper # SageLogix, Inc.
1 Database Administration. 2 Objectives  Understand, create, and drop views  Grant and revoke users’ privileges  Understand and obtain information.
1 All Powder Board and Ski Oracle 9i Workbook Chapter 9: Database Administration Jerry Post Copyright © 2003.
Oracle9i Performance Tuning Chapter 12 Tuning Tools.
What is a schema ? Schema is a collection of Database Objects. Schema Objects are logical structures created by users to contain, or reference, their data.
Database Design and Management CPTG /23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,
SQL: DDL John Ortiz Cs.utsa.edu.
Roles & privileges privilege A user privilege is a right to execute a particular type of SQL statement, or a right to access another user's object. The.
SQL Basic. What is SQL? SQL (pronounced "ess-que-el") stands for Structured Query Language. SQL is used to communicate with a database.
Commercial RDBMSs Access and Oracle. Access DBMS Architchecture  Can be used as a standalone system on a single PC: -JET Engine -Microsoft Data Engine.
What is a Package? A package is an Oracle object, which holds other objects within it. Objects commonly held within a package are procedures, functions,
Course FAQ’s I do not have any knowledge on SQL concepts or Database Testing. Will this course helps me to get through all the concepts? What kind of.
Objectives Database triggers and syntax
14 Copyright © 2006, Oracle. All rights reserved. Tuning Block Space Usage.
Week 4 Lecture 2 Advanced Table Management. Learning Objectives  Create tables with large object (LOB) columns and tables that are index-organized 
Visual Programing SQL Overview Section 1.
Module 11 Authorizing Users to Access Resources. Module Overview Authorizing User Access to Objects Authorizing Users to Execute Code Configuring Permissions.
Chapter 5 : Integrity And Security  Domain Constraints  Referential Integrity  Security  Triggers  Authorization  Authorization in SQL  Views 
Session 1 Module 1: Introduction to Data Integrity
Impala. Impala: Goals General-purpose SQL query engine for Hadoop High performance – C++ implementation – runtime code generation (using LLVM) – direct.
Transactions, Roles & Privileges Oracle and ANSI Standard SQL Lecture 11.
Altering Tables and Constraints Database Systems Objectives Add and modify columns. Add, enable, disable, or remove constraints. Drop a table. Remove.
A Guide to SQL, Eighth Edition Chapter Six Updating Data.
10g Tuning Highlights Presenter JEREMY SCHNEIDER Senior Consultant, ITC Technology Services.
Oracle 11g: SQL Chapter 7 User Creation and Management.
Stored Procedures / Session 4/ 1 of 41 Session 4 Module 7: Introducing stored procedures Module 8: More about stored procedures.
8 Copyright © 2005, Oracle. All rights reserved. Gathering Statistics.
 CONACT UC:  Magnific training   
SQL Tuning Scripts Bobby Durrett US Foodservice
What is the Flashback Database? Improves a database’s availability Useful alternative to traditional restoration methods Contains Flashback logs Archived.
Views / Session 3/ 1 of 40 Session 3 Module 5: Implementing Views Module 6: Managing Views.
7 Copyright © 2004, Oracle. All rights reserved. Managing Schema Objects.
11 Copyright © 2009, Oracle. All rights reserved. Enhancing ETL Performance.
Data Integrity & Indexes / Session 1/ 1 of 37 Session 1 Module 1: Introduction to Data Integrity Module 2: Introduction to Indexes.
SQL Server Statistics and its relationship with Query Optimizer
Creating Database Triggers
Using Data Dictionary and Dynamic Performance Views
Oracle Statistics by Example
Oracle9i Developer: PL/SQL Programming Chapter 8 Database Triggers.
Introduction to the Optimizer
Presentation transcript:

California State University Common Management Systems TUG Session: April 21, Overview Statistics in CMS PRD / Non-PRD Environments

TUG Session: April 21, California State University Common Management Systems What Do Statistics Do?  Cost Base Optimizer (CBO) Utilize statistics Oracle and PeopleSoft Recommended CBO CMS implemented CBO in PRD/RPT and non-PRD environments To execute any SQL statement, Oracle optimizer has to derive an 'execution plan'. The execution plan of a query is a description of how Oracle will implement the retrieval of data to satisfy a given SQL statement.  Rule Base Optimizer (RBO) Ignore statistics Oracle de-support RBO on release 10g

TUG Session: April 21, California State University Common Management Systems Where are statistics stored?  Three levels of statistics: table, index, column  Statistics stored into Oracle data dictionary in tables own by SYS account  Views created on these tables to retrieve data more easily  Views prefixed with DBA_ or ALL_ or USER_

TUG Session: April 21, California State University Common Management Systems Where are statistics stored? Table Level Statistics  DBA_ALL_TABLES  DBA_OBJECT_TABLES  DBA_TABLES  DBA_TAB_PARTITIONS  DBA_TAB_SUBPARTITIONS Table level statistics can be retrieved from:  NUM_ROWS  BLOCKS  EMPTY_BLOCKS*  AVG_SPACE*  CHAIN_CNT*  AVG_ROW_LEN  AVG_SPACE_FREELIST_BLOCKS  NUM_FREELIST_BLOCKS  SAMPLE_SIZE  LAST-ANALYZED  GLOBAL_STATS  USER_STATS Columns to look at are: * Statistics gathered by ANALYZE statement.

TUG Session: April 21, California State University Common Management Systems Where are statistics stored? Index Level Statistics  DBA_INDEXES  DBA_IND_PARTITIONS  DBA_IND_SUBPARTITIONS  BLEVEL  LEAF_BLOCKS  DISTINCT_KEYS  AVG_LEAF_BLOCKS_PER_KEY  AVG_DATA_BLOCKS_PER_KEY  CLUSTERING_FACTOR  SAMPLE_SIZE  LAST_ANALYZED  GLOBAL_STATS  USER_STATS  PCT_DIRECT_ACCESS Index level statistics can be retrieved from: Columns to look at are:

TUG Session: April 21, California State University Common Management Systems Where are statistics stored? Column Level Statistics  DBA_TAB_COLUMNS  DBA_TAB_COL_STATISTICS  DBA_PART_COL_STATISTICS  DBA_SUBPART_COL_STATISTI CS  NUM_DISTINCT  LOW_VALUE  HIGH_VALUE  DENSITY  NUM_NULLS  AVG_COL_LEN  NUM_BUCKETS  SAMPLE_SIZE  LAST_ANALYZED  GLOBAL_STATS  USER_STATS Column level statistics can be retrieved from: Columns to look at are: Note: The last three views extract statistics from DBA_TAB_COLUMNS.

TUG Session: April 21, California State University Common Management Systems How to gather Statistics?  ANALYZE statement  DBMS_UTILITY.ANALYZE_SCHEMA procedure  DBMS_STATS package Statistics gathering methods:

TUG Session: April 21, California State University Common Management Systems How to gather Statistics? ANALYZE statement  Gathers statistics on table/indexes and columns histograms  Collect non-optimizer statistics: Validate the structure of an index partition, table/table partition, index-organized table, cluster, or object reference Identify migrated and chained rows of a table or cluster Collect information on freelist blocks

TUG Session: April 21, California State University Common Management Systems How to gather Statistics? ANALYZE statement  Estimate statistics: ANALYZE TABLE tablename ESTIMATE STATISTICS SAMPLE 30 PERCENT;  Compute statistics: ANALYZE TABLE tablename COMPUTE STATISTICS; Note: The above ANALYZE statements will gather statistics for table, indexes and histograms on ALL columns for the table and it will cause performance issues with CMS automated gather stats (StatRanger) Oracle document does not recommend using the ANALYZE statement to gather optimizer statistics in 8i/9i

TUG Session: April 21, California State University Common Management Systems How to gather Statistics? DBMS_UTILITY.ANALYZE_SCHEMA  Run ANALYZE statement on each table in the specified schema  Gathers statistics on table, all indexes, histogram on ALL columns (default bucket size 75) Note: The DBMS_UTILITY.ANALYZE_SCHEMA procedure will cause performance issues with CMS automated gather stats process Oracle document does not recommend using the DBMS_UTILITY.ANALYZE_SCHEMA procedure to gather optimizer statistics in 8i/9i

TUG Session: April 21, California State University Common Management Systems How to gather Statistics? DBMS_STATS package  Generate and manage statistics only for cost-based optimization  Collect, delete, modify, view, export, import statistics and gather stale tables  Gather only statistics for database objects that have impact on the optimizer  Set or get statistics  Transfer statistics  Gather statistics in parallel Note: CMS uses DBMS_STATS package to gather optimizer statistics on PRD/RPT, non-PRD instances

TUG Session: April 21, California State University Common Management Systems How to gather Statistics? Oracle no longer enhance the ANALYZE statement and DBMS_UTILITY.ANALYZE_SCHEMA procedure Oracle recommended DBMS_STATS package to collect optimizer statistics on 8i/9i instances The cost-based optimizer, which depends upon statistics, will eventually use only statistics that have been collected by DBMS_STATS Note:

TUG Session: April 21, California State University Common Management Systems Checking for Stale Statistics  SYS.MON_MODS$ table keeps track of modifications to tables with MONITORING column=YES  MONITORING column tracks the number of INSERT, UPDATE, and DELETE operations for the tables since the last time statistics were gathered  DBA_TAB_MODIFICATIONS, ALL_TAB_MODIFICATIONS, or USER_TAB_MODIFICATIONS views identify tables with stale statistics Note: CMS uses DBMS_STATS package and MONITORING to gather stale tables every 4 hours via Oracle job

TUG Session: April 21, California State University Common Management Systems Checking for Stale Statistics Set pagesize 100 Set linesize 120 COL NUM_ROWS FORMAT 99,999,999 HEADING 'Num Row' COL table_name FORMAT a20 HEADING 'Table Name' COL STALE FORMAT HEADING 'Stale %' Sample SQL script, which list tables with stale statistics: SELECT b.table_name, TO_CHAR(b.LAST_ANALYZED, 'DD-MON-YY HH24:MI') Last_analyzed, ((a.INSERTS + a.UPDATES + a.DELETES)/(b.NUM_ROWS))*100 STALE, a.INSERTS, a.UPDATES, a.DELETES, b.NUM_ROWS FROM sys.dba_tab_modifications a, dba_tables b where a.table_name= b.table_name;

TUG Session: April 21, California State University Common Management Systems How CMS Gather Statistics  UNIVIEW application Centralize the management of the utilities including the CBO statistics gathering (StatRanger) Repository for CBO statistics gathering events by CBO_STATS package Use Oracle application form server - RCAT9P instance  StatRanger CMS central can define the CBO methods, global CBO exceptions, CBO exceptions for tables in each instance CMS central can manually force refresh statistics, reload old statistics, transfer statistics for tables and view the audit of the statistics gathering events Audit all changes to CBO exception rules

TUG Session: April 21, California State University Common Management Systems How CMS Gather Statistics UNIVIEW Main Menu StatRanger

TUG Session: April 21, California State University Common Management Systems How CMS Gather Statistics CBO Statistics Gathering Exceptions menu option:

TUG Session: April 21, California State University Common Management Systems How CMS Gather Statistics CBO Statistics Gathering Exceptions:

TUG Session: April 21, California State University Common Management Systems How CMS Gather Statistics CBO Statistics Gathering Exceptions:

TUG Session: April 21, California State University Common Management Systems How CMS Gather Statistics CBO Statistics Gathering Exceptions:

TUG Session: April 21, California State University Common Management Systems How CMS Gather Statistics CBO Audit Events menu option:

TUG Session: April 21, California State University Common Management Systems How CMS Gather Statistics CBO Statistic Gathering Events menu option:

TUG Session: April 21, California State University Common Management Systems How CMS Gather Statistics Note: 1. CMS automated the statistics gathering process by executing the CBO_STATS.GATHER_STATS procedure every 4 hours via Oracle job on each instance 2. The default CBO method option for gathering statistics in CMS environments is “FOR TABLE FOR ALL INDEXES FOR ALL INDEXED COLUMNS SIZE 75”

TUG Session: April 21, California State University Common Management Systems How CMS Gather Statistics  Gather statistics on tables which have stale statistics >= 10%  Gather statistics on tables/indexes which have no statistics  Turn on MONITORING for all SYSADM tables which have MONITORING=NO  Drop statistics for tables which have CBO method option as NONE  Audit the CBO events in RCAT9P CBO_STATS.GATHER_STATS procedure: Note: If a table name does not exist in the global or local CBO exception lists, the default statistics gathering method is “FOR ALL INDEXED COLUMNS SIZE 75”

TUG Session: April 21, California State University Common Management Systems Why We Do It? CMS proactively gathers statistics for any SYSADM table/index, which have no statistics or stale statistics to improve PeopleSoft processes/queries performance.

TUG Session: April 21, California State University Common Management Systems Overview Statistics in CMS PRD / Non-PRD Environments Questions?