Closing the Query Processing Loop in Oracle 11g Allison Lee, Mohamed Zait.

Slides:



Advertisements
Similar presentations
Starfish: A Self-tuning System for Big Data Analytics.
Advertisements

Module 13: Performance Tuning. Overview Performance tuning methodologies Instance level Database level Application level Overview of tools and techniques.
1.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Your customer as a segment of one That changes every second! Hein Van Der Merwe Chief.
1 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
Query Optimization of Frequent Itemset Mining on Multiple Databases Mining on Multiple Databases David Fuhry Department of Computer Science Kent State.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 1.
EXECUTION PLANS By Nimesh Shah, Amit Bhawnani. Outline  What is execution plan  How are execution plans created  How to get an execution plan  Graphical.
Jim Ferrentino Elizabeth West
Data Mining Methodology 1. Why have a Methodology  Don’t want to learn things that aren’t true May not represent any underlying reality ○ Spurious correlation.
Copyright © 200\8 Quest Software High Performance PL/SQL Guy Harrison Chief Architect, Database Solutions.
Oracle Universal Content Management and Storage Systems
A Java Architecture for the Internet of Things Noel Poore, Architect Pete St. Pierre, Product Manager Java Platform Group, Internet of Things September.
Clarity Educational Community Clarity Educational Community Creating and Tuning SQL Queries that Engage Users.
CS263 Lecture 19 Query Optimisation.  Motivation for Query Optimisation  Phases of Query Processing  Query Trees  RA Transformation Rules  Heuristic.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 2 Hidden Gems of APEX David Gale Software Engineer Oracle Application Express November,
HOL9396: Oracle Event Processing 12c
American Airlines AAdvantage®:
The Power of Business Process Management (BPM)
Oracle 11g Real Application Testing: Avoiding Performance Regressions with SQL Performance Analyzer Khaled Yagoub, Pete Belknap, Benoit Dageville, Karl.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. JD Edwards Summit The Newest JDE Module – Rental Management Joel Sandberg Sales Consultant.
© 2009 Oracle Corporation. S : Slash Storage Costs with Oracle Automatic Storage Management Ara Vagharshakian ASM Product Manager – Oracle Product.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 1 Preview of Oracle Database 12 c In-Memory Option Thomas Kyte
“This presentation is for informational purposes only and may not be incorporated into a contract or agreement.”
Relational Database Performance CSCI 6442 Copyright 2013, David C. Roberts, all rights reserved.
Executing Explain Plans and Explaining Execution Plans Craig Martin 01/20/2011.
Application Express 4.1 New Features Hilary Farrell, Principal Member of Technical Staff, Oracle.
1. When things go wrong: how to find SQL error Sveta Smirnova Principle Technical Support Engineer, Oracle.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Database Performance Tuning and Query Optimization.
Oracle PL/SQL Programming Steven Feuerstein All About the (Amazing) Function Result Cache of Oracle Database 11g.
RMB Billing UX Design Concepts / Proposals Peter Picone.
1 Robert Wijnbelt Health Check your Database A Performance Tuning Methodology.
Module 7 Reading SQL Server® 2008 R2 Execution Plans.
The Self-Managing Database: Guided Application and SQL Tuning Mohamed Ziauddin Consulting Member of Technical Staff Oracle Corporation Session id:
RBO RIP George Lumpkin Director Product Management Oracle Corporation Session id:
| Building the Effective Enterprise The Power of.Net Upgrade Jeffrey Steele – Solution Consultant, QAD.
SQL Tuning made much easier with SQLTXPLAIN (SQLT) Mauro Pagano Senior Principal Technical Support Engineer Oracle Confidential – Internal/Restricted/Highly.
11-1 Improve response time of interactive programs. Improve batch throughput. To ensure scalability of applications load vs. performance. Reduce system.
Quick Tips for Database Performance Tuning Sergey Koltakov Kurt Engeleiter Product Manager.
1. S318417: OAUG SysAdmin SIG Angelo Rosado, Oracle Senior Product Manager Kenneth Baxter, Oracle Strategy Product Manager Biju Mohan, Oracle Principal.
JDeveloper 10g and Oracle ADF Business Components Getting the Most Out of Your Data Avrom Roy-Faderman Senior Programmer November, 2005.
1Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Planning & Budgeting Cloud Service (PBCS) Overview Business Analytics Product Group.
MISSION CRITICAL COMPUTING Siebel Database Considerations.
Query Optimization CMPE 226 Database Systems By, Arjun Gangisetty
Rajesh Bhat Director, PLM Analytics Applications
Performance/Scalability with JDBC, UCP & Oracle Database 12c
20 Copyright © 2008, Oracle. All rights reserved. Cache Management.
Oracle9i Developer: PL/SQL Programming Chapter 11 Performance Tuning.
Travel and Transportation General Session and Industry Excellence Awards Vijay Anand, Oracle Sundar Swaminathan, Oracle September 30, 2014 Copyright ©
Database Systems, 8 th Edition SQL Performance Tuning Evaluated from client perspective –Most current relational DBMSs perform automatic query optimization.
SQL Server Statistics DEMO SQL Server Statistics SREENI JULAKANTI,MCTS.MCITP,MCP. SQL SERVER Database Administration.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 1.
Execution Plans Detail From Zero to Hero İsmail Adar.
Dynamic SQL Writing Efficient Queries on the Fly ED POLLACK AUTOTASK CORPORATION DATABASE OPTIMIZATION ENGINEER.
Improve query performance with the new SQL Server 2016 query store!! Michelle Gutzait Principal Consultant at
This document is provided for informational purposes only and Microsoft makes no warranties, either express or implied, in this document. Information.
SQL Server Statistics and its relationship with Query Optimizer
Query Optimization Techniques
JD Edwards EnterpriseOne In-Memory Sales Advisor
Stored Procedures – Facts and Myths
Using Adaptive Cursor Sharing (ACS) to produce multiple Optimal Plans
Access Path Selection in a Relational Database Management System
Charles Phillips screen
OpenWorld How to Prepare Data from Business Intelligence Cloud Service
Now where does THAT estimate come from?
JULIE McLAIN-HARPER LINKEDIN: JM HARPER
Recommending Materialized Views and Indexes with the IBM DB2 Design Advisor (Automating Physical Database Design) Jarek Gryz.
1.
Realizing Closed-loop, Online Tuning and Control for Configurable-Cache Embedded Systems: Progress and Challenges Islam S. Badreldin*, Ann Gordon-Ross*,
Presentation transcript:

Closing the Query Processing Loop in Oracle 11g Allison Lee, Mohamed Zait

Agenda Motivation Solution Overview Cardinality Feedback Adaptive Cursor Sharing General Feedback Process Experimental Results Conclusions

Motivation

Two query optimization problems: Estimating cardinality of intermediate results Optimizing queries containing query variables

Problem – Cardinality Estimation Cardinalities of tables affect the optimizer cost estimate Cardinality estimates are often poor quality Missing statistics Correlation between columns Complex operators Bad cardinality estimate results in poor plan

Problem – Query Variables select avg(e.salary), d.department_name from employees e, departments d where e.job_id = :job_v and e.employee_id = d.employee_id group by d.department_name Different bind values result in different intermediate cardinalities Optimal plan depends on bind value Plan chosen based on initial value then reused One plan not always appropriate for all bind values GB Y NLJ IX Optimal for “VP” GB Y HJ TS Optimal for “Sales Rep”

Solution

Solution Overview Two phase Solution 1.Collect information during execution 2.Use this information during subsequent optimization Cursor Cache SQL Execution Dictionary Parser Plan Generator Cost Estimator Query Transformation Code Generator SQL Compiler 1 2 User DB Application

Cursor Sharing Preliminaries A cursor stores the chosen plan in the cursor cache Caching avoids compilation overhead on every execution When a query is submitted “Soft parse” looks for matching cursor and uses it “Hard parse” no match found so query is compiled Prior to 11g Use bind variables – plan is shared Use literals – plan is not shared Optimizer peeks at bind value to estimate cardinalities

Cardinality Feedback

Addresses cardinality misestimates due to Missing statistics Inaccurate statistics Complex predicates Optimize the query as usual noting low quality estimates After execution compare actual cardinalities to estimates If estimates and actuals differ significantly Store actual values for later Force a re-optimization on next execution During optimization, use actuals instead of estimates

Example select e.employee_id, d.department_name from employees e, departments d where d.department_id = e.department_id and e.job_id = 'ST_CLERK' and e.salary < 3000 Difficult to estimate cardinality for equality AND inequality predicates First execution Estimate: 100 Actual: 1200 emp_job_ix dept_id_ix IX NL J Second execution Estimate: 1200 Actual: 1200 emp_job_ix departments TSTS IX HJ

Adaptive Cursor Sharing

Bind-Aware Cursor Sharing (BACS) Cursor sharing is aware of binds and selectivities Cursor stores a bind profile: Which binds’ values may affect plan Range of selectivities for each bind-containing predicate If a new bind value is outside of range, new cursor is built Cursors with same plan are merged Allowable selectivity range grows as cursors are merged merge

Example select avg(e.salary), d.department_name from employees e, departments d where e.job_id = :job and e.department_id = d.department_id group by d.department_name; First execution: :job = VP sel(e.job_id = :job) = 2% GB Y NLJ dept_id_ix IX emp_job_ix IX 0 1 Second execution: :job = sales rep sel(e.job_id = :job) = 28% GB Y HJ employees TS departments TS 01

Example (continued) State of cursor cache after two executions: GB Y NLJ dept_id_ix IX emp_job_ix IX GB Y HJ emp TS dept TS Third execution: job = clerk sel(e.job_id = :job) = 25% Use second cursor, selectivity is close enough

Adaptive Cursor Sharing Overhead of bind-aware cursor sharing Cursor matching is slower Additional re-optimizations consume CPU More cursors vying for space in cursor cache Use feedback to determine if BACS is warranted Adaptive cursor sharing (ACS) Monitor queries where BACS is applicable Identify queries with variable data volume Enable BACS for these queries

Example select avg(e.salary), d.department_name from employees e, departments d where e.job_id = :job and e.department_id = d.department_id group d.department_name; Big variation in # rows processed => use BACS First execution :job = VP 3 rows GB Y NLJ dept_id_ix IX emp_job_ix IX Second execution :job = sales rep 1000 rows GB Y NLJ dept_id_ix IX emp_job_ix IX

General Feedback Process no monitoring Feedback- enhanced Cursor Context Optimizer estimates Execution statistics … Cursor Context Optimizer estimates Execution statistics Enhanced compiler estimates… monitoring Cursor Context Optimizer estimates … SQL Compiler

Related Work Cardinality Feedback IBM Learning Optimizer (Stillger et al. VLDB 2001) Oracle Automatic SQL Tuning (Dageville et al. VLDB 2004) Adaptive Cursor Sharing SQL Server Auto Parameterization DB2 REOPT options

Experimental Results

Performance studies Oracle E-Business Suite (EBS) test database 60GB test system 14,000 tables, from tens to millions of rows EBS workload Over 300,000 queries Varying complexity, up to 140 tables per query Metrics Buffer gets Number of re-optimizations Number of distinct plans

Cardinality Feedback Execute 40,000 EBS queries twice each 10% of queries re-optimized, 4% get new plan

Performance Impact 924 queries improved by 68% 214 query degraded by 29% 58% overall improvement

Adaptive Cursor Sharing Approximately 400 queries average of 2.4 binds per query Queries known to generate multiple plans with different literals Machine-generated binds average of 55 bind sets per query 18% improvement with ACS 14% further improvement without cursor sharing

Results – Number of Plans Approximately 60 queries show multiple plans with ACS 20% fewer cursors with ACS vs. no sharing 45% more cursors with ACS vs. always sharing

Results – Impact of Feedback Compare ACS with and without feedback 5X fewer compilations with feedback 2X fewer cursors with feedback

Conclusions Feedback useful for two query optimization problems Intermediate cardinality estimation Optimization of queries with bind variables Solutions shipped in production release, Oracle 11g Performance improvement using a real SQL workload Future work Use framework for additional feedback-based optimization Persist feedback information

Questions & Answers

The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.