This is one of the 15 minute "TED" style talk presented as part of the Database Symposium at the ODTUG Kscope18 conference. In this presentation @SQLMaria shares details on 4 useful supplied PL/SQL package with the Oracle Database
This paper describes how the optimizer uses statistics and determines plans for executing SQL statement. It explains how the 10053 trace file can be used to understand Oracle's decisions on execution plans.
This is one of the 15 minute "TED" style talk presented as part of the Database Symposium at the ODTUG Kscope18 conference. In this presentation @SQLMaria shares details on 4 useful supplied PL/SQL package with the Oracle Database
This paper describes how the optimizer uses statistics and determines plans for executing SQL statement. It explains how the 10053 trace file can be used to understand Oracle's decisions on execution plans.
Online Statistics Gathering for Bulk Loads - the official name of the feature - was introduced in Oracle 12.1. The idea is to gather optimizer statistics "on the fly" for direct path loads. Sounds good for ETL? In certain scenarios it makes sense but even then there are many points to consider so that it becomes a reliable part of your ETL processes. When exactly will it be working and when not? Do you prevent it yourself? Documented, undocumented cases, known bugs. Which statistics are gathered and which are not? What has to be considered with partitioned tables? Interval partitioning - special case?
This is a presentation that identifies the various components of the 11i technology stack and how to generate log files for them for troubleshooting and debugging.
What is Optimizer Hint:
As the name suggest, it is a Hint to optimizer to change the resultant plan as per the hint. As it is just hint, so resultant plan may or may not be as per the hint given.
Why Optimizer Hint:
As a DBA you might know information about your data but the optimizer may not know, in this case DBA should be able to instruct the optimizer to choose a certain query execution plan based on some criteria.
More details and use cases in attachment.
This is a presentation that describes how Oracle uses histograms to make decisions on SQL query execution. To see the actual webinar and demo, go https://portal.hotsos.com/events/webinars/
In this first of a series of presentations, we'll overview the differences between SQL and PL/SQL, and the first steps in optimization, as understanding RULE vs. COST, and how to slash 90% response time in data extractions running in SQL*Plus.
ADAPTIVE FEATURES OR: HOW I LEARNED TO STOP WORRYING AND TROUBLESHOOT THE BOMBLudovico Caldara
Oracle Database 12c became available to the public back in 2013, but it took more than one year for the
Oracle customers to start upgrading of their existing databases to this new release. Many customers, in
2016, are still not in the process of migrating to 12c despite the premier support deadline for Oracle
Database 11g has passed in January 2015.
I had the chance to spend the last two years by a customer who decided to embrace the new release
and start the migration to 12c as soon as possible, in order to take the most out of the (many) new
features that this release offers. When the very first production databases have been migrated to 12c,
the users began noticing quite soon that some queries started to take much more time to complete,
some of them were actually several orders of magnitude slower than before. After small investigation, I
understood that most off those queries have been slowed down by the new “Adaptive Features” that
have been introduced in 12c for the opposite reason: increasing performance. This is what this article
is about.
Index is a database object, which can be created on one or more columns (16 Max column combinations). When creating the index will read the column(s) and forms a relevant data structure to minimize the number of data comparisons. The index will improve the performance of data retrieval and adds some overhead on data modification such as create, delete and modify. So it depends on how much data retrieval can be performed on table versus how much of DML (Insert, Delete and Update) operations
Before you optimize: Understanding Execution PlansTimothy Corey
You know what your query does, but do you know how it does it? Do you know what type of resources your query uses? This session covered these questions and more as we walked through reading execution plans. We saw how SQL breaks down the execution of your query and what each step tells us about the overall query. These slides provide the additional resources that go into the depth we couldn't get into in the session.
Online Statistics Gathering for Bulk Loads - the official name of the feature - was introduced in Oracle 12.1. The idea is to gather optimizer statistics "on the fly" for direct path loads. Sounds good for ETL? In certain scenarios it makes sense but even then there are many points to consider so that it becomes a reliable part of your ETL processes. When exactly will it be working and when not? Do you prevent it yourself? Documented, undocumented cases, known bugs. Which statistics are gathered and which are not? What has to be considered with partitioned tables? Interval partitioning - special case?
This is a presentation that identifies the various components of the 11i technology stack and how to generate log files for them for troubleshooting and debugging.
What is Optimizer Hint:
As the name suggest, it is a Hint to optimizer to change the resultant plan as per the hint. As it is just hint, so resultant plan may or may not be as per the hint given.
Why Optimizer Hint:
As a DBA you might know information about your data but the optimizer may not know, in this case DBA should be able to instruct the optimizer to choose a certain query execution plan based on some criteria.
More details and use cases in attachment.
This is a presentation that describes how Oracle uses histograms to make decisions on SQL query execution. To see the actual webinar and demo, go https://portal.hotsos.com/events/webinars/
In this first of a series of presentations, we'll overview the differences between SQL and PL/SQL, and the first steps in optimization, as understanding RULE vs. COST, and how to slash 90% response time in data extractions running in SQL*Plus.
ADAPTIVE FEATURES OR: HOW I LEARNED TO STOP WORRYING AND TROUBLESHOOT THE BOMBLudovico Caldara
Oracle Database 12c became available to the public back in 2013, but it took more than one year for the
Oracle customers to start upgrading of their existing databases to this new release. Many customers, in
2016, are still not in the process of migrating to 12c despite the premier support deadline for Oracle
Database 11g has passed in January 2015.
I had the chance to spend the last two years by a customer who decided to embrace the new release
and start the migration to 12c as soon as possible, in order to take the most out of the (many) new
features that this release offers. When the very first production databases have been migrated to 12c,
the users began noticing quite soon that some queries started to take much more time to complete,
some of them were actually several orders of magnitude slower than before. After small investigation, I
understood that most off those queries have been slowed down by the new “Adaptive Features” that
have been introduced in 12c for the opposite reason: increasing performance. This is what this article
is about.
Index is a database object, which can be created on one or more columns (16 Max column combinations). When creating the index will read the column(s) and forms a relevant data structure to minimize the number of data comparisons. The index will improve the performance of data retrieval and adds some overhead on data modification such as create, delete and modify. So it depends on how much data retrieval can be performed on table versus how much of DML (Insert, Delete and Update) operations
Before you optimize: Understanding Execution PlansTimothy Corey
You know what your query does, but do you know how it does it? Do you know what type of resources your query uses? This session covered these questions and more as we walked through reading execution plans. We saw how SQL breaks down the execution of your query and what each step tells us about the overall query. These slides provide the additional resources that go into the depth we couldn't get into in the session.
Strategies for SQL Server Index AnalysisJason Strate
Properly managing indexes for a database is a common use in many environments. When reviewing an index, should it have a single or multiple columns? Should the table be a heap, a clustered index or clustered columnstore index? These considerations are often at the forefront when analyzing your indexes. In this session, we'll look at easy methods for identifying new indexes, we'll review patterns for index consolidation, and discuss how and when to remove indexes. At the end, you'll have a strategy that helps design indexes to improve performance.
Query Optimization & How to interpret query execution planAmol Barewar
Efficient methods of processing unanticipated queries are a crucial prerequisite for the success of generalized database management systems. A wide variety of approaches to improve the performance of query evaluation algorithms have been proposed: logic-based and semantic transformations, fast implementations of basic operations, and combinatorial or heuristic algorithms for generating alternative access plans and choosing among them. These methods are presented in the framework of a general query evaluation procedure using the relational calculus representation of queries
"Using Indexes in SQL Server 2008" by Alexander Korotkiy, part 1 Andriy Krayniy
Speakers Corner Event at Ciklum Dnepropetrovsk Office. Alexander Korotkiy, Senior .NET Developer talking Indexes in MS SQL Server.Speakers Corner Event at Ciklum Dnepropetrovsk Office. Alexander Korotkiy, Senior .NET Developer talking Indexes in MS SQL Server.
This slide is introduced What is index in database system .
It's very simple to let you understand what is index pros and cons.
there has chinese voice version youtube :)
https://www.youtube.com/watch?v=BOBZAMfQfrQ&feature=youtu.be
https://www.youtube.com/watch?v=hkl5CcmZ4OI&feature=youtu.be
MySQL Performance Tuning: Top 10 Tips intended for PHP, Ruby and Java developers on performance tuning and optimization of MySQL. We will cover the deadly mistakes to be avoided. We will take real life examples of optimizing application many times. Here is the summary of what we intend to cover:
• Selection of Storage Engine
• Schema Optimization
• Server Tuning
• Hardware Selection and Tuning
• Effective uses of Index, when to use and when not to use.
• Partitions
• Speeding up using Stored Procedures
• Implementing prepared statements?
• Deadly Sins to be avoided
• Performance Tuning and Benchmarking Tools
MySQL users commonly ask: Here's my table, what indexes do I need? Why aren't my indexes helping me? Don't indexes cause overhead? This talk gives you some practical answers, with a step by step method for finding the queries you need to optimize, and choosing the best indexes for them.
Part 3 of the SQL Tuning workshop examines the different aspects of an execution plan, from cardinality estimates to parallel execution and explains what information you should be gleaming from the plan and how it affects the execution. It offers insight into what caused the Optimizer to make the decision it did as well as a set of corrective measures that can be used to improve each aspect of the plan.
Ground Breakers Romania: Explain the explain_planMaria Colgan
This session was delivered as part of the EMEA Ground Breakers tour in Romania, Oct. 2019. The execution plan for a SQL statement can often seem complicated and hard to understand. Determining if the execution plan you are looking at is the best plan you could get or attempting to improve a poorly performing execution plan can be a daunting task even for the most experienced DBA or developer. This session examines the different aspects of an execution plan, from selectivity to parallel execution and explains what information you should be gleaming from the plan and how it affects the execution. It offers insight into what caused the Optimizer to make the decision it did as well as a set of corrective measures that can be used to improve each aspect of the plan.
Design and develop with performance in mind
Establish a tuning environment
Index wisely
Reduce parsing
Take advantage of Cost Based Optimizer
Avoid accidental table scans
Optimize necessary table scans
Optimize joins
Use array processing
Consider PL/SQL for “tricky” SQL
This presentation features the fundamentals of SQL tunning like SQL Processing, Optimizer and Execution Plan, Accessing Tables, Performance Improvement Consideration Partition Technique. Presented by Alphalogic Inc : https://www.alphalogicinc.com/
The final part of the SQL Tuning workshop focuses on applying the techniques discussed in the previous sections to help diagnose and correct a number of problematic SQL statements and shows how you can use SQL Plan Management or a SQL Patch to influence an execution plan.
Optimizer is the component of the DB2 SQL compiler responsible for selecting an optimal access plan for an SQL statement. The optimizer works by calculating the execution cost of many alternative access plans, and then choosing the one with the minimal estimated cost. Understanding how the optimizer works and knowing how to influence its behaviour can lead to improved query performance and better resource usage.
This presentation was created for the workshop delivered at the CASCON 2011 conference. Its aim is to introduce basic optimizer and related concepts, and to serve as a starting point for further study of the optimizer techniques.
Antes de migrar de 10g a 11g o 12c, tome en cuenta las siguientes consideraciones. No es tan sencillo como simplemente cambiar de motor de base de datos, se necesita hacer consideraciones a nivel del aplicativo.
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...Dave Stokes
Slow query? Add an index or two! But things are suddenly even slower! Indexes are great tools to speed data lookup but have overhead issues. Histograms don’t have that overhead but may not be suited. And how you lock rows also effects performance. So what do you do to speed up queries smartly?
Brad McGehee's presentation on "How to Interpret Query Execution Plans in SQL Server 2005/2008".
Presented to the San Francisco SQL Server User Group on March 11, 2009.
Part1 of SQL Tuning Workshop - Understanding the OptimizerMaria Colgan
Part 1 of a 5 part SQL Tuning workshop, This presentation covers the history of the Oracle Optimizer and explains the first thing the Optimizer does when it receives a SQL statements, which is to transform the SQL statement in order to open up additional access paths.
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
Search and Society: Reimagining Information Access for Radical FuturesBhaskar Mitra
The field of Information retrieval (IR) is currently undergoing a transformative shift, at least partly due to the emerging applications of generative AI to information access. In this talk, we will deliberate on the sociotechnical implications of generative AI for information access. We will argue that there is both a critical necessity and an exciting opportunity for the IR community to re-center our research agendas on societal needs while dismantling the artificial separation between the work on fairness, accountability, transparency, and ethics in IR and the rest of IR research. Instead of adopting a reactionary strategy of trying to mitigate potential social harms from emerging technologies, the community should aim to proactively set the research agenda for the kinds of systems we should build inspired by diverse explicitly stated sociotechnical imaginaries. The sociotechnical imaginaries that underpin the design and development of information access technologies needs to be explicitly articulated, and we need to develop theories of change in context of these diverse perspectives. Our guiding future imaginaries must be informed by other academic fields, such as democratic theory and critical theory, and should be co-developed with social science scholars, legal scholars, civil rights and social justice activists, and artists, among others.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
"Impact of front-end architecture on development cost", Viktor TurskyiFwdays
I have heard many times that architecture is not important for the front-end. Also, many times I have seen how developers implement features on the front-end just following the standard rules for a framework and think that this is enough to successfully launch the project, and then the project fails. How to prevent this and what approach to choose? I have launched dozens of complex projects and during the talk we will analyze which approaches have worked for me and which have not.
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
2. <Insert Picture Here>
Explaining the Explain Plan:
Interpreting Execution Plans for SQL Statements
Maria Colgan
Senior Principal Product Manager
3. 3
<Insert Picture Here>
Agenda
• What is an execution plan
• How to generate a plan
• What is a good plan for the optimizer
• Understanding execution plans
– Cardinality
– Access paths
– Join type
– Join order
• Execution plan examples
4. 4
What is an Execution plan?
• Execution plans show the detailed steps necessary to
execute a SQL statement
• These steps are expressed as a set of database
operators that consumes and produces rows
• The order of the operators and their implementation is
decided by the optimizer using a combination of query
transformations and physical optimization techniques
• The display is commonly shown in a tabular format,
but a plan is in fact tree-shaped
5. 5
What is an Execution plan?
Query:
SELECT prod_category, avg(amount_sold)
FROM sales s, products p
WHERE p.prod_id = s.prod_id
GROUP BY prod_category;
Tabular representation of plan
-----------------------------------------------------------
Id Operation Name
-----------------------------------------------------------
0 SELECT STATEMENT
1 HASH GROUP BY
2 HASH JOIN
3 TABLE ACCESS FULL PRODUCTS
4 PARTITION RANGE ALL
5 TABLE ACCESS FULL SALES
----------------------------------------------------------
GROUP BY
HASH JOIN
TABLE ACCESS
SALES
TABLE ACCESS
PRODUCTS
Tree-shaped representation of plan
6. 6
<Insert Picture Here>
Agenda
• What is an execution plan
• How to generate a plan
• What is a good plan for the optimizer
• Understanding execution plans
– Cardinality
– Access paths
– Join type
– Join order
• Execution plan examples
7. 7
How to get an Execution Plan
Two methods for looking at the execution plan
1. EXPLAIN PLAN command
– Displays an execution plan for a SQL statement without actually
executing the statement
2. V$SQL_PLAN
– A dictionary view introduced in Oracle 9i that shows the execution
plan for a SQL statement that has been compiled into a cursor in
the cursor cache
Either way use DBMS_XPLAN package to display plans
Under certain conditions the plan shown with EXPLAIN PLAN
can be different from the plan shown using V$SQL_PLAN
8. 8
How to get an Execution Plan Example 1
• EXPLAIN PLAN command & dbms_xplan.display
function
SQL> EXPLAIN PLAN FOR SELECT prod_name, avg(amount_sold)
FROM sales s, products p
WHERE p.prod_id = s.prod_id
GROUP BY prod_name;
SQL> SELECT plan_table_output
FROM table(dbms_xplan.display('plan_table',null,'basic'));
------------------------------------------
Id Operation Name
------------------------------------------
0 SELECT STATEMENT
1 HASH GROUP BY
2 HASH JOIN
3 TABLE ACCESS FULL PRODUCTS
4 PARTITION RANGE ALL
5 TABLE ACCESS FULL SALES
-------------------------------------------
9. 9
How to get an Execution Plan Example 2
• Generate & display execution plan for last SQL
stmts executed in a session
SQL>SELECT prod_category, avg(amount_sold)
FROM sales s, products p
WHERE p.prod_id = s.prod_id
GROUP BY prod_category;
SQL> SELECT plan_table_output
FROM table(dbms_xplan.display_cursor(null,null,'basic'));
------------------------------------------
Id Operation Name
------------------------------------------
0 SELECT STATEMENT
1 HASH GROUP BY
2 HASH JOIN
3 TABLE ACCESS FULL PRODUCTS
4 PARTITION RANGE ALL
5 TABLE ACCESS FULL SALES
-------------------------------------------
10. 10
<Insert Picture Here>
Agenda
• What is an execution plan
• How to generate a plan
• What is a good plan for the optimizer
• Understanding execution plans
– Cardinality
– Access paths
– Join type
– Join order
• Execution plan examples
11. 11
What’s a Good Plan for the Optimizer?
The Optimizer has two different goals
• Serial execution: It’s all about cost
– The cheaper, the better
• Parallel execution: it’s all about performance
– The faster, the better
Two fundamental questions:
• What is cost?
• What is performance?
12. 12
What is Cost?
• A magically number the optimizer makes up?
• Resources required to execute a SQL statement?
• Result of complex calculations?
• Estimate of how long it will take to execute a statement?
Actual Definition
• Cost represents units of work or resources used
• Optimizer uses CPU & IO as units of work
• Cost is an estimate of the amount of CPU and the number of disk
I/Os, used to perform an operation
Cost is an internal Oracle measurement
13. 13
What is performance?
• Getting as many queries completed as possible?
• Getting fastest possible elapsed time using the fewest
resources?
• Getting the best concurrency rate?
Actual Definition
• Performance is fastest possible response time for a query
• Goal is to complete the query as quickly as possible
• Optimizer does not focus on resources needed to execute the plan
14. 14
<Insert Picture Here>
Agenda
• What is an execution plan
• How to generate a plan
• What is a good plan for the optimizer
• Understanding execution plans
– Cardinality
– Access paths
– Join type
– Join order
• Execution plan examples
15. 15
Cardinality
What is it?
• Estimate of number rows that will be returned by each operation
How does the Optimizer Determine it?
• Cardinality for a single column equality predicate = total num of rows
num of distinct values
– For example: A table has 100 rows, a column has 10 distinct values
=> cardinality=10 rows
• More complicated predicates have more complicated cardinality
calculation
Why should you care?
• Influences everything! Access method, Join type, Join Order etc
16. 16
How to Identify Cardinality in an Execution Plan
Cardinality the estimated
# of rows returned
Determine correct cardinality using a SELECT COUNT(*) from each table applying
any WHERE Clause predicates belonging to that table
17. 17
Check Cardinality Estimates
SELECT /*+ gather_plan_statistics */ p.prod_name, SUM(s.quantity_sold)
FROM sales s, products p
WHERE s.prod_id =p.prod_id GROUP By p.prod_name ;
SELECT * FROM table (
DBMS_XPLAN.DISPLAY_CURSOR(FORMAT=>'ALLSTATS LAST'));
Compare the estimated number of rows returned for each operation in the
plan to actual rows returned
18. 18
Check Cardinality using SQL Monitor
SQL Monitor is the easiest way to compare the estimated number of rows returned for each
operation in a parallel plan to actual rows returned
19. 19
Solutions to incorrect Cardinality estimates
Cause Solution
Stale or missing statistics DBMS_STATS
Data Skew Create a histogram
Multiple single column predicates
on a table
Create a column group using
DBMS_STATS.CREATE_EXTENDED_STATS
Function wrapped column Create statistics on the funct wrapped
column using
DBMS_STATS.CREATE_EXTENDED_STATS
Multiple columns used in a join Create a column group on join columns using
DBMS_STATS.CREATE_EXTENDED_STAT
Complicated expression
containing columns from multiple
tables
Use dynamic sampling level 4 or higher
20. 20
<Insert Picture Here>
Agenda
• What is an execution plan
• How to generate a plan
• What is a good plan for the optimizer
• Understanding execution plans
– Cardinality
– Access paths
– Join type
– Join order
• Execution plan examples
21. 21
Access Paths – Getting the data
Access Path Explanation
Full table scan Reads all rows from table & filters out those that do not meet the where clause
predicates. Used when no index, DOP set etc
Table access by Rowid Rowid specifies the datafile & data block containing the row and the location of
the row in that block. Used if rowid supplied by index or in where clause
Index unique scan Only one row will be returned. Used when stmt contains a UNIQUE or a
PRIMARY KEY constraint that guarantees that only a single row is accessed
Index range scan Accesses adjacent index entries returns ROWID values Used with equality on
non-unique indexes or range predicate on unique index (<.>, between etc)
Index skip scan Skips the leading edge of the index & uses the rest Advantageous if there are
few distinct values in the leading column and many distinct values in the non-
leading column
Full index scan Processes all leaf blocks of an index, but only enough branch blocks to find 1st
leaf block. Used when all necessary columns are in index & order by clause
matches index struct or if sort merge join is done
Fast full index scan Scans all blocks in index used to replace a FTS when all necessary columns
are in the index. Using multi-block IO & can going parallel
Index joins Hash join of several indexes that together contain all the table columns that are
referenced in the query. Wont eliminate a sort operation
Bitmap indexes uses a bitmap for key values and a mapping function that converts each bit
position to a rowid. Can efficiently merge indexes that correspond to several
conditions in a WHERE clause
22. 22
How to Identify Access Path in an Execution Plan
If the wrong access method is being used check cardinality, join order…
Look in Operation section to
see how an object is being
accessed
23. 23
Access Path examples
A table countries contains 10K rows & has a primary key on
country_id – What plan would you expect for these queries?
Select country_id, name from countries
where country_id in ('AU','FR','IE‘);
Select country_id, name from countries
where country_id between 'AU' and 'IE';
24. 24
Access Path examples
A table countries contains 10K rows & has a primary key on
country_id – What plan would you expect for these queries?
Select country_id, name from countries where name='USA';
25. 25
Common Access Path issues
Issue Cause
Uses a table scan instead of index DOP on table but not index, value of MBRC
Picks wrong index Stale or missing statistics
Cost of full index access is cheaper than
index look up followed by table access
Picks index that matches most # of column
26. 26
<Insert Picture Here>
Agenda
• What is an execution plan
• How to generate a plan
• What is a good plan for the optimizer
• Understanding execution plans
– Cardinality
– Access paths
– Join type
– Join order
• Execution plan examples
27. 27
Join Types
Join Type Explanation
Nested Loops joins For every row in the outer table, Oracle accesses all the rows in the
inner table Useful when joining small subsets of data and there is
an efficient way to access the second table (index look up)
Hash Joins The smaller of two tables is scan and resulting rows are used to build
a hash table on the join key in memory. The larger table is then
scan, join column of the resulting rows are hashed and the values
used to probing the hash table to find the matching rows. Useful
for larger tables & if equality pred
Sort Merge joins Consists of two steps:
1. Both the inputs are sorted on the join key.
2. The sorted lists are merged together.
Useful when the join condition between two tables is an inequality
condition or one of the table is already ordered e.g. index access
Cartesian Joins Joins every row from one data source with every row from the other
data source, creating the Cartesian Product of the two sets. Only
good if tables are very small. Only choice if there is no join
condition specified in query
Outer Joins Returns all rows that satisfy the join condition and also returns all of
the rows from the table without the (+) for which no rows from the
other table satisfy the join condition
28. 28
How to Identify Join Type in an Execution Plan
If wrong join type is used check stmt is written correctly & cardinality estimates
Look in the Operation section
to check the right join type is
used
29. 29
Join Type Example 1
What Join type should be use for this Query?
SELECT e.last_name, e.salary, d.department_name
FROM hr.employees e, hr.departments d
WHERE d.departments_name IN ('Marketing‘,'Sales')
AND e.department_id=d.department_id;
Employees has 107 rows
Departments has 27 rows
Foreign key relationship between Employees and Departments on dept_id
30. 30
Join Type Example 2
What Join type should be use for this Query?
SELECT o.customer_id, l.unit_price * l.quantity
FROM oe.orders o ,oe.order_items l
WHERE l.order_id = o.order_id;
Orders has 105 rows
Order Items has 665 rows
31. 31
Join Type Example 3
What Join type should be use for this Query?
SELECT o.order_id,0.order_date,e.name
FROM oe.orders o , hr.employees e;
Orders has 105 rows
Employees has 107 rows
32. 32
Join Type Example 3
Cartesian product not always bad
• Chosen when the number of rows being joined is low
• Commonly used to join multiple small dimensions to
one large fact table
CUSTOMERSPRODUCTS
PROMOTIONS
s.prod_id=p.prod_id s.cust_id=c.cust_id
SALES
s.promo_id=c.promo_id
33. 33
Join Type Example 3
Cartesian product
• By joining the three small dimension tables together
first we minimize the number of rows being carried
through the joins
34. 34
Join Type Example 4
What Join type should be use for this Query?
SELECT d.department_id,e.emp_id
FROM hr.employees e FULL OUTER JOIN hr.departments d
ON e.department_id = d.department_id
ORDER BY d.department_id;
Employees has 107 rows
Departments has 27 rows
Foreign key relationship between Employees and Departments on dept_id
35. 35
What causes the wrong Join Type to be selected
Issue Cause
Nested loop
selected instead
of hash join
Cardinality estimate on the left side is under
estimated triggers Nested loop to be selected
Hash join selected
instead of nested
loop
In case of a hash join the Optimizer doesn’t taken
into consideration the benefit of caching. Rows on
the left come in a clustered fashion or (ordered)
so the probe into the right is less expensive
Cartesian Joins Cardinality underestimation
36. 36
<Insert Picture Here>
Agenda
• What is an execution plan
• How to generate a plan
• What is a good plan for the optimizer
• Understanding execution plans
– Cardinality
– Access paths
– Join type
– Join order
• Execution plan examples
37. 37
Join Orders
The order in which the tables are join in a multi table stmt
• Ideally start with the table that will eliminate the most rows
• Strongly affected by the access paths available
Some basic rules
• Joins guaranteed to produce at most one row always go first
– Joins between two row sources that have only one row each
• When outer joins are used the table with the outer join
operator must come after the other table in the predicate
• If view merging is not possible all tables in the view will be
joined before joining to the tables outside the view
38. 38
How to Identify Join order in an Execution Plan
If the join order is not correct, check the statistics, cardinality & access methods
1
2
3
Want to start with the table that
reduce the result set the most
4
5
39. 39
Finding the Join Order for complex SQL statement
The leading hint tells
you the join order
• It can be hard to determine Join Order for Complex SQL
statements but it is easily visible in the outline data of plan
SELECT *
FROM
table(dbms_xplan.display_cursor(FORMAT=>’TYPICAL +outline’);
40. 40
What causes the wrong Join Order
Causes
Incorrect single table cardinality estimates
Incorrect join cardinality estimates
41. 41
<Insert Picture Here>
Agenda
• What is an execution plan
• How to generate a plan
• What is a good plan for the optimizer
• Understanding execution plans
– Cardinality
– Access paths
– Join type
– Join order
• Execution plan examples
42. 42
Example SQL Statement
• Find all the employees who make as much or more than
their manager
SELECT e1.last_name, e1.job_title, e1.total_comp
FROM (SELECT e.manager_id, e.last_name, j.job_title,
(e.salary+e.commission_pct) total_comp
FROM employees e, jobs j, departments d
WHERE d.department_name = 'Sales'
AND e.department_id = d.department_id
AND e.job_id = j.job_id ) e1,
(SELECT e.employee_id, (e.salary+e.commission_pct) tc
FROM employees e, departments d
WHERE d.department_name = ‘Sales'
AND e.department_id = d.department_id ) e2
WHERE e1.manager_id = e2.employee_id
AND e1.total_comp >= e2.tc;
43. 43
Is it a good Execution plan?
Means no stats gathered
strong indicator this won’t be
best possible plan
1. Is the estimated number of
rows being returned
accurate?
2. Are the cardinality
estimates accurate?
3.Are the access
method correct?
44. 44
Example Cont’d Execution plan
5. Is the join order correct? Is the table that
eliminates the most rows accessed first?
4. Are the right join types being used?
1
2
3
4
5
45. 45
What does the Plan Tree look like?
MERGE JOIN
CARTESIAN
TABLE ACCESS
EMPLOYEES
TABLE ACCESS
DEPARTMENT
TABLE ACCESS
EMPLOYEES
HASH JOIN
INDEX UNIQUE SCAN -
TABLE ACCESS
DEPARTMENT
NESTED LOOP INDEX UNIQUE SCAN -
TABLE ACCESS JOBS
NESTED LOOP
46. 46
Example Cont’d Execution plan - Solution
2. Cardinalities are correct
and with each join number of
rows reduced
1. Only 1 row is actually returned and
the cost is 4 lower now
4. Join types have
changed to be all NL
3. Access methods
have changed for
some tables
1
2
3
5. The join
order has
changed
5
4
47. 47
What does the Plan Tree look like?
TABLE ACCESS
DEPARTMENT
NESTED LOOP
INDEX UNIQUE SCAN -
TABLE ACCESS
DEPARTMENT
NESTED LOOP
INDEX UNIQUE SCAN -
TABLE ACCESS JOBS
NESTED LOOP
NESTED LOOP
INDEX RANGE SCAN -
TABLE ACCESS
EMPLOYEES
INDEX RANGE SCAN -
TABLE ACCESS
EMPLOYEES
49. 49
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.