Articles tagged execution plans

18 October 2016
18 October 2016

Retrieving SQL Server Query Execution Plans

Execution plans explain all you need to know about query performance, and how to fine-tune. Sure, you can see them in SSMS, but what if you need to drill into to the important details? What about using DMVs, Extended Events or SET statements to get at the execution plans? To get the best use of execution plans you need to be able to get right information from the right plan at the right time. Robert Sheldon explains how.… Read more
08 May 2015
08 May 2015

Optimizing Batch Process in SQL Server

SQL Server batch processes are usually run from SQL Agent in background. They can take significant time and resources, especially if they are ETL tasks. Quite often, the responsibility for creating these tasks belongs entirely to the developer. Dennes demonstrates that DBAs can advise and assist with this type of batch job by bringing their expertise to bear on the problem of reducing their impact on the working system to a minimum.… Read more
26 March 2015
26 March 2015

Execution Plans Part 14: SQL Monitoring

0
2
This is the last part of my series on Execution plans, and features an option which is only available if you have licensed the Diagnostic and Performance Packs. It’s a feature that allows you to watch the flow of data through an execution plan as the query is running, typically through the graphic interface supplied by Enterprise Manager  (or Grid… Read more
11 March 2015
11 March 2015

Execution Plans Part 13: SQL Trace

0
3
In parts 11 and 12 of this series I described the “rowsource execution statistics” that we can collect as Oracle runs a query, then described a strategy for generating and accessing these statistics in a way that was particularly convenient if you could use your own session to run the SQL you wanted to analyze. In this article we’re going… Read more
12 January 2015
12 January 2015

Why Developers Need to Understand Execution Plans

As a coder, the more you know about the business, the better code you're going to write. The more you know about the language in which you code regularly, the better code you're going to write. Similarly, if you're tasked with writing code against a relational database engine, you're going to need to know more about that engine. If you can examine and understand execution plans, you can achieve better understanding of the database system and you will write better database code. Grant Fritchey shows you how.… Read more
31 December 2014
31 December 2014

Exploring Query Plans in SQL

SQL Server keeps the most-used execution plans in cache, so it doesn't need to recompile the same queries every time. How can we benefit from this to find potential performance problems in execution plans? Let's see how to find some opportunities for optimization by using information held in SQL Server's plan cache.… Read more
17 December 2014
17 December 2014

Execution Plans Part 11: Actuals

0
4
So far in this series we’ve talked about interpreting the shape of an execution plan and understanding the meaning of the predictions that the optimizer has made about cost and cardinality. It’s finally time to see how Oracle gives us execution plans that show us how well the optimizer’s estimates match the actual work done as the query ran. Ther… Read more
09 September 2014
09 September 2014

Execution Plans Part 10: Guesswork

0
1
In part 9 we saw an example of a simple nested loop join where the basic method for interpreting the numbers in an execution plan started to break down because the arithmetic used by the optimizer to calculate the resource costs for the plan wasn’t consistent with the visual representation of the mechanics of the run-time path. In this instalment we’r… Read more
29 August 2014
29 August 2014

Execution Plans Part 9: Multiplication

0
1
In part 8 we looked at a very simple execution plan involving a hash join; but that example was too simple to give us the full flavour of the arithmetic involved in Oracle’s predictions because every operation executed just once. We need to see some plans where each execution of a parent operation could requires multiple executions of its child… Read more
19 August 2014
19 August 2014

Execution Plans Part 8: Cost, time, etc.

0
11
It’s time to move away from the shape of an execution plan and turn our attention to some of the numerical information we get from the plan. In this article we’re going to look only at the predictions that the optimizer makes (explain plan), postponing any investigation of actual run-time figures (v$sql_plan_statistics_all) for future instalments. Getting Started As a referenc… Read more
09 July 2014
09 July 2014

Execution Plans Part 7: Query Blocks and Inline Views

0
10
When we examine an execution plan, we’re usually trying to work out the mechanical steps that Oracle took to produce a result set. When we do this, it’s important to remember that the text that Oracle optimized wasn’t necessarily the same as the statement we originally wrote. Oracle may have transformed our statement before passing it through the optimization engin… Read more
16 June 2014
16 June 2014

Execution Plans Part 6: Pushed Subqueries

0
4
In part 5 of this series we examined a couple of examples where you had to handle the “first child first” rule with a little care. In part 6 we continue this exploration to look at a general principle – the “pushed subquery” – where the “first child first” could lead you to the wrong conclusion. Access or Filter If… Read more
28 May 2014
28 May 2014

Execution Plans part 5: First Child Variations

0
4
I’ve offered up “first child first, recursive descent” as a basic strategy for interpreting execution plans – but it’s not a perfect rule, and it can be easy to lose track of what’s going on even when the basic “first child first” is being obeyed. In this article we’ll be looking at a couple of examples where we will st… Read more
14 May 2014
14 May 2014

Execution Plans Part 4: Precision and Timing

0
7
In part 3 of this series we used a simple hash join to introduce the a simple guideline for reading execution plans – the “first child first, recursive descent” method. This allowed us to work out the order in which Oracle produced rowsources and (implicitly) the order in which it visited the different physical objects in the query. At t… Read more
01 May 2014
01 May 2014

SPM Plan: non reproducibility circumstances and CBO interaction

0
4
 1.   Introduction When a critical report which used to complete very quickly starts performing poorly, there is a big chance that the generic reason for this time response degradation is due to a change in an execution plan. If you want to avoid this flip-flop on plan and execution time you have at your disposal a feature called SQL Plan… Read more
25 April 2014
25 April 2014

Execution Plans Part 3: “The Rule”

0
11
In the first two articles in this series we listed a couple of methods for generating or retrieving execution plans and learned a few extra steps that could increase our confidence that we were using the right environment to investigate any problems we might have with a plan. In this article we’re going to become acquainted with a basic (though, as… Read more
26 March 2014
26 March 2014

Execution Plans Part 2: Things to see

0
13
In part 1 of this series we saw two basic ways of creating, or acquiring, execution plans. The first method gave us the optimizer’s prediction of what it would (possibly) do if you ran the query: explain plan for {sql statement} select * from table(dbms_xplan.display); The second method told us what the optimizer had done after we ran the query… Read more
12 March 2014
12 March 2014

Execution Plans: Part 1 Finding plans

0
150
If you have to tackle performance problems in an Oracle database one of the most important skills you need to acquire is the ability to interpret execution plans, and in this series of articles I’ll be telling you how to do just that. We’ll start with a couple of articles that look at some of the ways we can access… Read more