<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>DB Optimizer &#187; vst</title>
	<atom:link href="/tag/vst/feed/" rel="self" type="application/rss+xml" />
	<link>http://dboptimizer.com</link>
	<description>database performance, SQL tuning and data visualizatoin</description>
	<lastBuildDate>Thu, 07 Jun 2018 15:59:24 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.6</generator>
		<item>
		<title>Woohoo: VST takes the next step</title>
		<link>http://dboptimizer.com/2011/07/08/woohoo-vst-takes-the-next-step/</link>
		<comments>http://dboptimizer.com/2011/07/08/woohoo-vst-takes-the-next-step/#comments</comments>
		<pubDate>Fri, 08 Jul 2011 06:30:21 +0000</pubDate>
		<dc:creator>Kyle Hailey</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[vst]]></category>

		<guid isPermaLink="false">http://dboptimizer.com/?p=1111</guid>
		<description><![CDATA[&#160; for more info see Visual SQL Tuning available in DB Optimizer $429 seat from Idera  ( I have no association with Idera but I did design the product when working at Embarcadero where it was originally created) http://dboptimizer.com/db-optimizer/ http://dboptimizer.com/tag/vst/ The new release of  DB Optimizer , version 3.o, from Embarcadero has awesome new feature : explain [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>&nbsp;</p>
<p>for more info see</p>
<ul>
<li>Visual SQL Tuning available in <a href="https://www.idera.com/buynow/onlinestore?ptid={ab9650f5-fb7c-439f-bfce-395a1817728b}#DBOptimizer">DB Optimizer $429 seat from Idera</a>  ( I have no association with Idera but I did design the product when working at Embarcadero where it was originally created)</li>
<li><a title="http://dboptimizer.com/db-optimizer/" href="/db-optimizer/">http://dboptimizer.com/db-optimizer/</a></li>
<li><a title="http://dboptimizer.com/tag/vst/" href="posts on VST">http://dboptimizer.com/tag/vst/</a></li>
</ul>
<p>The new release of  DB Optimizer , version 3.o, from Embarcadero has awesome new feature : explain plan overlay onto VST diagrams!</p>
<p>Let&#8217;s take an example query:</p>
<pre style="padding-left: 30px;">SELECT COUNT (*)
FROM   a,
       b,
       c
WHERE
       b.val2 = 100 AND
       a.val1 = b.id AND
       b.val1 = c.id;</pre>
<p>There are  indexes on b.id and c.id.  Diagramming the query in DB Optimizer gives</p>
<p><a href="/wp-content/uploads/2011/07/m2m.png"><img class="alignnone size-full wp-image-1112" title="m2m" alt="" src="/wp-content/uploads/2011/07/m2m.png" width="259" height="66" /></a></p>
<p>The red lines with crows feet mean that as far as the definitions go, the relations could be many to many.</p>
<p>Question is &#8220;what is the optimal execution path for this query?&#8221;</p>
<p>One of  the best execution plans is to</p>
<ol>
<li>start at the most selective filter table</li>
<li>join to children  if possible</li>
<li>else join to parent</li>
</ol>
<p>There is one filter in the diagram, represented by the green F on table B. Table B has a filter criteria in the query &#8220;b.val2=100&#8243;.</p>
<p>Ok, table B is where we start the query. Now where do we go from B? Who is the parent and who is the child? It&#8217;s not defined in the constraints nor indexes on these tables so it&#8217;s hard for us to know. Guess what ? It&#8217;s also hard for Oracle to figure it out. Well, what does Oracle decide to do? This is where the cool part of DB Optimizer 3.o comes in.</p>
<p>The super cool thing with DB Optimizer 3.0 is we can overlay the diagram with the actual execution path (I think this is so awesome)</p>
<p><a href="/wp-content/uploads/2011/07/m2m_explain.png"><img class="alignnone size-full wp-image-1113" title="m2m_explain" alt="" src="/wp-content/uploads/2011/07/m2m_explain.png" width="167" height="192" /></a></p>
<p>For the digram we can see Oracle starts with B and joins to A. The result if this is joined to C. Is this the optimal path?</p>
<p>Well, let&#8217;s keep the same indexes and just add some constraints:</p>
<pre style="padding-left: 30px;">alter table c add constraint c_pk_con unique (id);
alter table b add constraint b_pk_con unique (id);</pre>
<p>Now let&#8217;s diagram the query with DB Optimizer:</p>
<p style="padding-left: 60px;"><a href="/wp-content/uploads/2011/07/o2m.png"><img class="alignnone size-full wp-image-1114" title="o2m" alt="" src="/wp-content/uploads/2011/07/o2m.png" width="105" height="219" /></a></p>
<p>We can now see who the parent and child is, so we can determine the optimal query path which is to start at B, the only filter and  join to the child C then to the parent A.  Now what does Oracle do with the added constraint info:</p>
<p><a href="/wp-content/uploads/2011/07/o2m_explain.png"><img class="alignnone size-full wp-image-1115" title="o2m_explain" alt="" src="/wp-content/uploads/2011/07/o2m_explain.png" width="178" height="221" /></a></p>
<p>Guess what? The execution plan has now changed with the addition of constraints and now Oracle&#8217;s execution path goes from a suboptimal plan to  the optimal path. Moral of the story is to make sure and define constraint information because it helps the optimizer, but what I wanted to show here was the explain plan overlay on the diagram which makes comparing execution plans much easier. Putting the queries VST diagrams side by side along with the overlay of execution path we can clearly and quickly see the differences:</p>
<p><a href="/wp-content/uploads/2011/07/m2m_explain.png"><img title="m2m_explain" alt="" src="/wp-content/uploads/2011/07/m2m_explain.png" width="167" height="192" /></a><a href="/wp-content/uploads/2011/07/o2m_explain.png"><img title="o2m_explain" alt="" src="/wp-content/uploads/2011/07/o2m_explain.png" width="178" height="221" /></a></p>
<p>I plan to blog more about this awesome feature. It&#8217;s really cool.</p>
<p>Here is an example from an article by Jonathan Lewis</p>
<p><a href="http://www.simple-talk.com/sql/performance/designing-efficient-sql-a-visual-approach/">http://www.simple-talk.com/sql/performance/designing-efficient-sql-a-visual-approach/</a></p>
<p>The query Jonathan discusses is</p>
<pre>SELECT order_line_data
FROM
         customers cus
         INNER JOIN
         orders ord
         ON ord.id_customer = cus.id
         INNER JOIN
         order_lines orl
         ON orl.id_order = ord.id
         INNER JOIN
         products prd1
         ON prd1.id = orl.id_product
         INNER JOIN
         suppliers sup1
         ON sup1.id = prd1.id_supplier
   WHERE
         cus.location = 'LONDON' AND
         ord.date_placed BETWEEN '04-JUN-10' AND '11-JUN-10' AND
         sup1.location = 'LEEDS' AND
    EXISTS (SELECT NULL
            FROM
                 alternatives alt
                 INNER JOIN
                 products prd2
                 ON prd2.id = alt.id_product_sub
                 INNER JOIN
                 suppliers sup2
                 ON sup2.id = prd2.id_supplier
           WHERE
                  alt.id_product = prd1.id AND
                  sup2.location != 'LEEDS')</pre>
<p>which diagrammed looks like</p>
<p><a href="/wp-content/uploads/2011/07/jl.png"><img class="alignnone size-full wp-image-1116" title="jl" alt="" src="/wp-content/uploads/2011/07/jl.png" width="616" height="427" /></a></p>
<p>There are multiple filters, so we need to know which one is the most selective to know where to start, so we ask DB Optimizer to display the statistics as well  (blue below a table is the filter %, green above is # of rows in table and numbers on join lines are rows returned by a join of just those two tables)</p>
<p><a href="/wp-content/uploads/2011/07/jl_stats.png"><img class="alignnone size-full wp-image-1117" title="jl_stats" alt="" src="/wp-content/uploads/2011/07/jl_stats.png" width="640" height="415" /></a></p>
<p>Now that we can determine a candidate for best optimization path, does Oracle take it?</p>
<p><a href="/wp-content/uploads/2011/07/jl_stats_explain.png"><img class="alignnone size-full wp-image-1118" title="jl_stats_explain" alt="" src="/wp-content/uploads/2011/07/jl_stats_explain.png" width="665" height="443" /></a></p>
<p>Can you find the optimization error?</p>
<p>Dark green is where execution starts. There are two starts: one for the main query body and one for the subquery.</p>
<p>The red is where query execution ends.</p>
<p>( also see this older blog on the designing VST <a href="/2010/08/03/product-design-vst/">http://dboptimizer.com/2010/08/03/product-design-vst/</a> )</p>
<p>PS a big part of this work is by the lead developer Matt Vegh. Many thanks to Matt for this awesome work.</p>
<p>&nbsp;</p>
<p>PPS another example from Karl Arao</p>
<p><a href="/wp-content/uploads/2011/07/karl2.png"><img class="alignnone size-large wp-image-1173" title="karl2" alt="" src="/wp-content/uploads/2011/07/karl2-942x1024.png" width="565" height="614" /></a></p>
<p>The dark green nodes are starts, so there are 4 separate starts. We can see how the result sets from each start are joined with each successive table join set. The red is the final step.</p>
]]></content:encoded>
			<wfw:commentRss>http://dboptimizer.com/2011/07/08/woohoo-vst-takes-the-next-step/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SQL Tuning Best Practice – Visualizing the Query</title>
		<link>http://dboptimizer.com/2010/09/10/sql-tuning-best-practice-%e2%80%93-visualizing-the-query/</link>
		<comments>http://dboptimizer.com/2010/09/10/sql-tuning-best-practice-%e2%80%93-visualizing-the-query/#comments</comments>
		<pubDate>Fri, 10 Sep 2010 15:00:00 +0000</pubDate>
		<dc:creator>Kyle Hailey</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[vst]]></category>

		<guid isPermaLink="false">http://dboptimizer.com/?p=135</guid>
		<description><![CDATA[SQL tuning can be a challenge to even the most experienced database professional. So, how can you give yourself a leg up in optimizing a difficult query? As you will discover in this best practice, visualizing the query can help you quickly understand the query, as well as define its optimal execution path. A best [&#8230;]]]></description>
				<content:encoded><![CDATA[<p class="MsoNormal" style="margin-bottom:5.0pt;line-height:normal;mso-outline-level: 3;background:white"><span class="Apple-style-span"   style="font-family:Arial, sans-serif;font-size:6;"><span class="Apple-style-span"  style="font-size:19px;"><b><span class="Apple-style-span"   style=" font-weight: normal;  font-family:Arial, Verdana, sans-serif;font-size:13px;"></span></b></span></span></p>
<p><span class="Apple-style-span"   style="font-family:Arial, sans-serif;font-size:6;"><b><br />
<h3 xmlns="http://www.w3.org/1999/xhtml" id="sites-page-title-header" align="left" dir="ltr" style="font-size: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(0, 0, 0); padding-top: 3px; padding-right: 10px; padding-bottom: 3px; padding-left: 10px; "></h3>
<div id="sites-canvas-main" class="sites-canvas-main" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(255, 255, 255); min-height: 150px; padding-bottom: 5px; background-position: initial initial; background-repeat: initial initial; ">
<div id="sites-canvas-main-content">
<table xmlns="http://www.w3.org/1999/xhtml" cellspacing="0" class="sites-layout-name-one-column sites-layout-hbox" style="width: 916px; table-layout: fixed; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">
<tbody>
<tr>
<td class="sites-layout-tile sites-tile-name-content-1" style="vertical-align: top; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; ">
<div dir="ltr">
<div><span style=" ;font-family:Arial, sans-serif;">SQL tuning can be a challenge to even the most experienced database professional. So, how can you give yourself a leg up in optimizing a difficult query?<span> </span>As you will discover in this best practice, visualizing the query can help you quickly understand the query, as well as define its optimal execution path.</span></div>
<p style="margin-bottom: 0.0001pt; line-height: normal; "><span style=" ;font-family:Arial, sans-serif;">A best practice for visualizing the query is to draw the query out as a Visual SQL Tuning (VST) diagram.</span></p>
<p style="margin-bottom: 0.0001pt; line-height: normal; "><span style=" ;font-family:Arial, sans-serif;">A VST diagram consists of the following elements: </span></p>
<ul>
<li style="line-height: normal; "><span style=" ;font-family:Arial, sans-serif;">    tables as nodes</span></li>
<li style="line-height: normal; "><span style=" ;font-family:Arial, sans-serif;">    joins as connectors</span></li>
<li style="line-height: normal; "><span style=" ;font-family:Arial, sans-serif;">    filter percentages</span></li>
<li style="line-height: normal; "><span style=" ;font-family:Arial, sans-serif;">    relationships </span></li>
<li style="line-height: normal; "><span style=" ;font-family:Arial, sans-serif;">    join sizes </span></li>
</ul>
<p style="margin-bottom: 0.0001pt; line-height: normal; "><span style=" ;font-family:Arial, sans-serif;">Historically, SQL tuning has been limited to the following two approaches: </span></p>
<ol style="list-style-type: decimal; ">
<li><span style=" ;font-family:Arial, sans-serif;">Explain plan for the query; and/or </span></li>
<li><span style=" ;font-family:Arial, sans-serif;">Trace the query</span></li>
</ol>
<p style="margin-bottom: 0.0001pt; line-height: normal; "><span style=" ;font-family:Arial, sans-serif;">For example, a trace output might look something like this:e</span></p>
<div></div>
<blockquote  style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border- padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color:initial;"><div>
<div class="sites-codeblock sites-codesnippet-block" style="background-color: rgb(239, 239, 239); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(211, 211, 211); border-right-color: rgb(211, 211, 211); border-bottom-color: rgb(211, 211, 211); border-left-color: rgb(211, 211, 211); display: block; padding-top: 0.5em; padding-right: 0px; padding-bottom: 0.5em; padding-left: 1em; line-height: 13px; "><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">PARSING IN CURSOR #2 </span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">len</span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">=53 </span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">dep</span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">=0 </span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">uid</span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">=61 </span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">oct</span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">=3 lid=61 </span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">tim</span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">=1151519905950403 </span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">hv</span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">=2296704914 ad='4e50010c'</span></code><span style=" ;font-size:x-small;"><br /></span><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">SELECT 'Hello, world; today is ' || SYSDATE FROM dual</span></code><span style=" ;font-size:x-small;"><br /></span><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">END OF STMT</span></code><span style=" ;font-size:x-small;"><br /></span><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">PARSE #2:c=4000,e=1540,p=0,cr=0,cu=0,mis=1,r=0,dep=0,og=1,tim=1151519905950397</span></code><span style=" ;font-size:x-small;"><br /></span><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">BINDS #2:</span></code><span style=" ;font-size:x-small;"><br /></span><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">EXEC #2:c=0,e=58,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,tim=1151519906034782</span></code><span style=" ;font-size:x-small;"><br /></span><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">WAIT #2: </span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">nam</span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">='SQL*Net message to client' </span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">ela</span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">= 2 driver id=1650815232 #bytes=1 p3=0 </span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">obj</span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">#=-1 </span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">tim</span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">=1151519906034809</span></code><span style=" ;font-size:x-small;"><br /></span><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">FETCH #2:c=0,e=29,p=0,cr=0,cu=0,mis=0,r=1,dep=0,og=1,tim=1151519906034864</span></code><span style=" ;font-size:x-small;"><br /></span><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">WAIT #2: </span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">nam</span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">='SQL*Net message from client' </span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">ela</span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">= 215 driver id=1650815232 #bytes=1 p3=0 </span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">obj</span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">#=-1 </span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">tim</span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">=1151519906035133</span></code><span style=" ;font-size:x-small;"><br /></span><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">FETCH #2:c=0,e=1,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=0,tim=1151519906035165</span></code><span style=" ;font-size:x-small;"><br /></span><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">WAIT #2: </span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">nam</span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">='SQL*Net message to client' </span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">ela</span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">= 1 driver id=1650815232 #bytes=1 p3=0 </span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">obj</span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">#=-1 </span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">tim</span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">=1151519906035188</span></code><span style=" ;font-size:x-small;"><br /></span><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">WAIT #2: </span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">nam</span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">='SQL*Net message from client' </span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">ela</span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">= 192 driver id=1650815232 #bytes=1 p3=0 </span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">obj</span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">#=-1 </span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">tim</span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">=1151519906035400</span></code><span style=" ;font-size:x-small;"><br /></span><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">STAT #2 id=1 </span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">cnt</span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">=1 </span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">pid</span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">=0 pos=1 </span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">obj</span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">=0 op='FAST DUAL  (</span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">cr</span></code></span><span style="  ;font-family:Arial;color:black;"><code style="color: rgb(0, 96, 0); "><span style=" ;font-size:x-small;">=0 pr=0 pw=0 time=3 us)</span></code></span></div>
</div>
</blockquote>
<div><span><span></span></span></div>
<div></div>
<p style="margin-bottom: 0.0001pt; line-height: normal; "><span style="  ;font-family:Arial, sans-serif;font-size:10pt;">Not exactly user-friendly. I think I might need a couple of double espressos before I plunge into this one.</span></p>
<p style="margin-bottom: 0.0001pt; line-height: normal; "><span style="  ;font-family:Arial, sans-serif;font-size:10pt;"><span style="line-height: 14px; ">How about an explain plan? An explain plan is better, but still lacking insightful information</span></span></p>
<div>
<div></div>
<blockquote style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><div></div>
<div class="sites-codeblock sites-codesnippet-block" style="background-color: rgb(239, 239, 239); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(211, 211, 211); border-right-color: rgb(211, 211, 211); border-bottom-color: rgb(211, 211, 211); border-left-color: rgb(211, 211, 211); display: block; padding-top: 0.5em; padding-right: 0px; padding-bottom: 0.5em; padding-left: 1em; line-height: 13px; ">
<div>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><code style="color: rgb(0, 96, 0); ">--------------------------------------------------------------------------------------------</code></span></p>
</div>
<div>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><code style="color: rgb(0, 96, 0); ">| Id</code><span><code style="color: rgb(0, 96, 0); ">  </code></span><code style="color: rgb(0, 96, 0); ">| Operation</code><span><code style="color: rgb(0, 96, 0); ">                           </code></span><code style="color: rgb(0, 96, 0); ">| Name</code><span><code style="color: rgb(0, 96, 0); ">               </code></span><code style="color: rgb(0, 96, 0); ">| Starts | E-Rows | A-Rows |</code></span></p>
</div>
<div>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><code style="color: rgb(0, 96, 0); ">---------------------------------------------------------------------------------------------</code></span></p>
</div>
<div>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">   </code></span><code style="color: rgb(0, 96, 0); ">1 |</code><span><code style="color: rgb(0, 96, 0); ">  </code></span><code style="color: rgb(0, 96, 0); ">HASH GROUP BY</code><span><code style="color: rgb(0, 96, 0); ">                      </code></span><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">                    </code></span><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">1 |</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">1 |</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">1 |</code></span></p>
</div>
<div>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><code style="color: rgb(0, 96, 0); ">|*</code><span><code style="color: rgb(0, 96, 0); ">  </code></span><code style="color: rgb(0, 96, 0); ">2 |</code><span><code style="color: rgb(0, 96, 0); ">   </code></span><code style="color: rgb(0, 96, 0); ">FILTER</code><span><code style="color: rgb(0, 96, 0); ">                            </code></span><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">                    </code></span><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">1 |</code><span><code style="color: rgb(0, 96, 0); ">        </code></span><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">   </code></span><code style="color: rgb(0, 96, 0); ">1909 |</code></span></p>
</div>
<div>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><code style="color: rgb(0, 96, 0); ">|*</code><span><code style="color: rgb(0, 96, 0); ">  </code></span><code style="color: rgb(0, 96, 0); ">3 |</code><span><code style="color: rgb(0, 96, 0); ">    </code></span><code style="color: rgb(0, 96, 0); ">TABLE ACCESS BY INDEX ROWID</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">| PS_RETROPAYPGM_TBL |</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">1 |</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">1 |</code><span><code style="color: rgb(0, 96, 0); ">   </code></span><code style="color: rgb(0, 96, 0); ">3413 |</code></span></p>
</div>
<div>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">   </code></span><code style="color: rgb(0, 96, 0); ">4 |</code><span><code style="color: rgb(0, 96, 0); ">     </code></span><code style="color: rgb(0, 96, 0); ">NESTED LOOPS</code><span><code style="color: rgb(0, 96, 0); ">                    </code></span><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">                    </code></span><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">1 |</code><span><code style="color: rgb(0, 96, 0); ">    </code></span><code style="color: rgb(0, 96, 0); ">165 |</code><span><code style="color: rgb(0, 96, 0); ">   </code></span><code style="color: rgb(0, 96, 0); ">6827 |</code></span></p>
</div>
<div>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><code style="color: rgb(0, 96, 0); ">|*</code><span><code style="color: rgb(0, 96, 0); ">  </code></span><code style="color: rgb(0, 96, 0); ">5 |</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">HASH JOIN</code><span><code style="color: rgb(0, 96, 0); ">                      </code></span><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">                    </code></span><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">1 |</code><span><code style="color: rgb(0, 96, 0); ">    </code></span><code style="color: rgb(0, 96, 0); ">165 |</code><span><code style="color: rgb(0, 96, 0); ">   </code></span><code style="color: rgb(0, 96, 0); ">3413 |</code></span></p>
</div>
<div>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><code style="color: rgb(0, 96, 0); ">|*</code><span><code style="color: rgb(0, 96, 0); ">  </code></span><code style="color: rgb(0, 96, 0); ">6 |</code><span><code style="color: rgb(0, 96, 0); ">       </code></span><code style="color: rgb(0, 96, 0); ">HASH JOIN</code><span><code style="color: rgb(0, 96, 0); ">                     </code></span><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">                    </code></span><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">1 |</code><span><code style="color: rgb(0, 96, 0); ">    </code></span><code style="color: rgb(0, 96, 0); ">165 |</code><span><code style="color: rgb(0, 96, 0); ">   </code></span><code style="color: rgb(0, 96, 0); ">3624 |</code></span></p>
</div>
<div>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">   </code></span><code style="color: rgb(0, 96, 0); ">7 |</code><span><code style="color: rgb(0, 96, 0); ">        </code></span><code style="color: rgb(0, 96, 0); ">TABLE ACCESS BY INDEX ROWID</code><span><code style="color: rgb(0, 96, 0); ">  </code></span><code style="color: rgb(0, 96, 0); ">| WB_JOB</code><span><code style="color: rgb(0, 96, 0); ">             </code></span><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">1 |</code><span><code style="color: rgb(0, 96, 0); ">    </code></span><code style="color: rgb(0, 96, 0); ">242 |</code><span><code style="color: rgb(0, 96, 0); ">   </code></span><code style="color: rgb(0, 96, 0); ">2895 |</code></span></p>
</div>
<div>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">   </code></span><code style="color: rgb(0, 96, 0); ">8 |</code><span><code style="color: rgb(0, 96, 0); ">         </code></span><code style="color: rgb(0, 96, 0); ">NESTED LOOPS</code><span><code style="color: rgb(0, 96, 0); ">                </code></span><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">                    </code></span><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">1 |</code><span><code style="color: rgb(0, 96, 0); ">    </code></span><code style="color: rgb(0, 96, 0); ">233 |</code><span><code style="color: rgb(0, 96, 0); ">   </code></span><code style="color: rgb(0, 96, 0); ">2897 |</code></span></p>
</div>
<div>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">   </code></span><code style="color: rgb(0, 96, 0); ">9 |</code><span><code style="color: rgb(0, 96, 0); ">          </code></span><code style="color: rgb(0, 96, 0); ">TABLE ACCESS BY INDEX ROWID| PS_PAY_CALENDAR</code><span><code style="color: rgb(0, 96, 0); ">    </code></span><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">1 |</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">1 |</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">1 |</code></span></p>
</div>
<div>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><code style="color: rgb(0, 96, 0); ">|* 10 |</code><span><code style="color: rgb(0, 96, 0); ">           </code></span><code style="color: rgb(0, 96, 0); ">INDEX RANGE SCAN</code><span><code style="color: rgb(0, 96, 0); ">          </code></span><code style="color: rgb(0, 96, 0); ">| PS0PAY_CALENDAR</code><span><code style="color: rgb(0, 96, 0); ">    </code></span><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">1 |</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">1 |</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">1 |</code></span></p>
</div>
<div>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><code style="color: rgb(0, 96, 0); ">|* 11 |</code><span><code style="color: rgb(0, 96, 0); ">          </code></span><code style="color: rgb(0, 96, 0); ">INDEX RANGE SCAN</code><span><code style="color: rgb(0, 96, 0); ">           </code></span><code style="color: rgb(0, 96, 0); ">| WBBJOB_B</code><span><code style="color: rgb(0, 96, 0); ">           </code></span><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">1 |</code><span><code style="color: rgb(0, 96, 0); ">    </code></span><code style="color: rgb(0, 96, 0); ">286 |</code><span><code style="color: rgb(0, 96, 0); ">   </code></span><code style="color: rgb(0, 96, 0); ">2895 |</code></span></p>
</div>
<div>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><code style="color: rgb(0, 96, 0); ">|* 12 |</code><span><code style="color: rgb(0, 96, 0); ">        </code></span><code style="color: rgb(0, 96, 0); ">TABLE ACCESS FULL</code><span><code style="color: rgb(0, 96, 0); ">            </code></span><code style="color: rgb(0, 96, 0); ">| WB_RETROPAY_EARNS</code><span><code style="color: rgb(0, 96, 0); ">  </code></span><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">1 |</code><span><code style="color: rgb(0, 96, 0); ">  </code></span><code style="color: rgb(0, 96, 0); ">27456 |</code><span><code style="color: rgb(0, 96, 0); ">    </code></span><code style="color: rgb(0, 96, 0); ">122K|</code></span></p>
</div>
<div>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">  </code></span><code style="color: rgb(0, 96, 0); ">13 |</code><span><code style="color: rgb(0, 96, 0); ">       </code></span><code style="color: rgb(0, 96, 0); ">TABLE ACCESS FULL</code><span><code style="color: rgb(0, 96, 0); ">             </code></span><code style="color: rgb(0, 96, 0); ">| PS_RETROPAY_RQST</code><span><code style="color: rgb(0, 96, 0); ">   </code></span><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">1 |</code><span><code style="color: rgb(0, 96, 0); ">  </code></span><code style="color: rgb(0, 96, 0); ">13679 |</code><span><code style="color: rgb(0, 96, 0); ">  </code></span><code style="color: rgb(0, 96, 0); ">13679 |</code></span></p>
</div>
<div>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><code style="color: rgb(0, 96, 0); ">|* 14 |</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">INDEX RANGE SCAN</code><span><code style="color: rgb(0, 96, 0); ">               </code></span><code style="color: rgb(0, 96, 0); ">| PS#RETROPAYPGM_TBL |</code><span><code style="color: rgb(0, 96, 0); ">   </code></span><code style="color: rgb(0, 96, 0); ">3413 |</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">1 |</code><span><code style="color: rgb(0, 96, 0); ">   </code></span><code style="color: rgb(0, 96, 0); ">3413 |</code></span></p>
</div>
<div>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">  </code></span><code style="color: rgb(0, 96, 0); ">15 |</code><span><code style="color: rgb(0, 96, 0); ">    </code></span><code style="color: rgb(0, 96, 0); ">SORT AGGREGATE</code><span><code style="color: rgb(0, 96, 0); ">                   </code></span><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">                    </code></span><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">   </code></span><code style="color: rgb(0, 96, 0); ">1791 |</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">1 |</code><span><code style="color: rgb(0, 96, 0); ">   </code></span><code style="color: rgb(0, 96, 0); ">1791 |</code></span></p>
</div>
<div>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">  </code></span><code style="color: rgb(0, 96, 0); ">16 |</code><span><code style="color: rgb(0, 96, 0); ">     </code></span><code style="color: rgb(0, 96, 0); ">FIRST ROW</code><span><code style="color: rgb(0, 96, 0); ">                       </code></span><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">                    </code></span><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">   </code></span><code style="color: rgb(0, 96, 0); ">1791 |</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">1 |</code><span><code style="color: rgb(0, 96, 0); ">   </code></span><code style="color: rgb(0, 96, 0); ">1579 |</code></span></p>
</div>
<div>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><code style="color: rgb(0, 96, 0); ">|* 17 |</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">INDEX RANGE SCAN (MIN/MAX)</code><span><code style="color: rgb(0, 96, 0); ">     </code></span><code style="color: rgb(0, 96, 0); ">| WB_JOB_F</code><span><code style="color: rgb(0, 96, 0); ">           </code></span><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">   </code></span><code style="color: rgb(0, 96, 0); ">1791 |</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">1 |</code><span><code style="color: rgb(0, 96, 0); ">   </code></span><code style="color: rgb(0, 96, 0); ">1579 |</code></span></p>
</div>
<div>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">  </code></span><code style="color: rgb(0, 96, 0); ">18 |</code><span><code style="color: rgb(0, 96, 0); ">       </code></span><code style="color: rgb(0, 96, 0); ">SORT AGGREGATE</code><span><code style="color: rgb(0, 96, 0); ">                </code></span><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">                    </code></span><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">   </code></span><code style="color: rgb(0, 96, 0); ">1539 |</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">1 |</code><span><code style="color: rgb(0, 96, 0); ">   </code></span><code style="color: rgb(0, 96, 0); ">1539 |</code></span></p>
</div>
<div>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">  </code></span><code style="color: rgb(0, 96, 0); ">19 |</code><span><code style="color: rgb(0, 96, 0); ">        </code></span><code style="color: rgb(0, 96, 0); ">FIRST ROW</code><span><code style="color: rgb(0, 96, 0); ">                    </code></span><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">                    </code></span><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">   </code></span><code style="color: rgb(0, 96, 0); ">1539 |</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">1 |</code><span><code style="color: rgb(0, 96, 0); ">   </code></span><code style="color: rgb(0, 96, 0); ">1539 |</code></span></p>
</div>
<div>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><code style="color: rgb(0, 96, 0); ">|* 20 |</code><span><code style="color: rgb(0, 96, 0); ">         </code></span><code style="color: rgb(0, 96, 0); ">INDEX RANGE SCAN (MIN/MAX)</code><span><code style="color: rgb(0, 96, 0); ">  </code></span><code style="color: rgb(0, 96, 0); ">| WB_JOB_G</code><span><code style="color: rgb(0, 96, 0); ">           </code></span><code style="color: rgb(0, 96, 0); ">|</code><span><code style="color: rgb(0, 96, 0); ">   </code></span><code style="color: rgb(0, 96, 0); ">1539 |</code><span><code style="color: rgb(0, 96, 0); ">      </code></span><code style="color: rgb(0, 96, 0); ">1 |</code><span><code style="color: rgb(0, 96, 0); ">   </code></span><code style="color: rgb(0, 96, 0); ">1539 |</code></span></p>
</div>
<div>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><code style="color: rgb(0, 96, 0); ">---------------------------------------------------------------------------------------------</code></span></p>
</div>
<div>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><code style="color: rgb(0, 96, 0); ">Predicate Information (identified by operation id):</code></span></p>
</div>
<div>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><code style="color: rgb(0, 96, 0); ">---------------------------------------------------</code></span></p>
</div>
<div>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><span><code style="color: rgb(0, 96, 0); ">   <span style="color: rgb(0, 0, 0);  font-family:'Courier New';">2 - filter(("B"."EFFDT"= AND "B"."EFFSEQ"=))</span></code></span></span></p>
</div>
<div>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><span>   </span>3 &#8211; filter(&#8220;E&#8221;.&#8221;OFF_CYCLE&#8221;=&#8221;A&#8221;.&#8221;PAY_OFF_CYCLE_CAL&#8221;)</span></p>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><span>   </span>5 &#8211; access(&#8220;D&#8221;.&#8221;RETROPAY_SEQ_NO&#8221;=&#8221;C&#8221;.&#8221;RETROPAY_SEQ_NO&#8221;)</span></p>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><span>   </span>6 &#8211; access(&#8220;C&#8221;.&#8221;EMPLID&#8221;=&#8221;B&#8221;.&#8221;EMPLID&#8221; AND &#8220;C&#8221;.&#8221;EMPL_RCD#&#8221;=&#8221;B&#8221;.&#8221;EMPL_RCD#&#8221;)</span></p>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><span>  </span>10 &#8211; access(&#8220;A&#8221;.&#8221;RUN_ID&#8221;=&#8217;PD2&#8242; AND &#8220;A&#8221;.&#8221;PAY_CONFIRM_RUN&#8221;=&#8217;N')</span></p>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><span>  </span>11 &#8211; access(&#8220;B&#8221;.&#8221;COMPANY&#8221;=&#8221;A&#8221;.&#8221;COMPANY&#8221; AND &#8220;B&#8221;.&#8221;PAYGROUP&#8221;=&#8221;A&#8221;.&#8221;PAYGROUP&#8221;)</span></p>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><span>  </span>12 &#8211; filter((&#8220;C&#8221;.&#8221;RETROPAY_PRCS_FLAG&#8221;=&#8217;C&#8217; AND &#8220;C&#8221;.&#8221;RETROPAY_LOAD_SW&#8221;=&#8217;Y'))</span></p>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><span>  </span>14 &#8211; access(&#8220;E&#8221;.&#8221;RETROPAY_PGM_ID&#8221;=&#8221;D&#8221;.&#8221;RETROPAY_PGM_ID&#8221;)</span></p>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><span>  </span>17 &#8211; access(&#8220;F&#8221;.&#8221;EMPLID&#8221;=:B1 AND &#8220;F&#8221;.&#8221;EMPL_RCD#&#8221;=:B2 AND &#8220;F&#8221;.&#8221;EFFDT&#8221;<=:B3)</span></p>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="   ;font-family:'Courier New';font-size:8pt;color:black;"><span>  </span>20 &#8211; access(&#8220;G&#8221;.&#8221;EMPLID&#8221;=:B1 AND &#8220;G&#8221;.&#8221;EMPL_RCD#&#8221;=:B2 AND &#8220;G&#8221;.&#8221;EFFDT&#8221;=:B3)</span></p>
</div>
<div></div>
</div>
<p></p></blockquote>
<div>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="  ;font-family:'Courier New';color:black;"></span></p>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="  ;font-family:'Courier New';color:black;"></span></p>
<p style="margin-top: 0pt; margin-bottom: 0pt; text-align: left; direction: ltr; vertical-align: baseline; "><span style="  ;font-family:'Courier New';color:black;"></span></p>
</div>
<p style="margin-bottom: 0.0001pt; line-height: normal; "><span style=" ;font-family:Arial, sans-serif;">If I was greeted with this first thing in the morning, I&#8217;d definitely get a coffee before attempting to operate on it.</span></p>
<p style="margin-bottom: 0.0001pt; line-height: normal; "><span style=" ;font-family:Arial, sans-serif;">The explain plan is just a set of directions that the database takes to retrieve the data from the database in order to satisfy an SQL query. An analogy would be if we imagine the SQL query as a google maps request for directions to get from my home in the suburbs to my office downtown. The explain plan is like the turn-by-turn route list. But for any of us who have gotten lost well know, it’s also nice to be able to see the map as well as the turn-by-turn directions.</span></p>
<p style="margin-bottom: 0.0001pt; line-height: normal; "><span style=" ;font-family:Arial, sans-serif;">If google maps only gave me the directions without the map I&#8217;d be pretty upset, probably lost and totally anxious about how long it&#8217;s going to take me to get to my destination.</span></p>
<p style="margin-bottom: 0.0001pt; line-height: normal; "><span style=" ;font-family:Arial, sans-serif;"> <span style=" ;font-family:Arial, Verdana, sans-serif;"><span style=" line-height: 14px; font-family:Arial, sans-serif;">Are these a good set of directions? (from where I live to where I work, in San Francisco):</span></span></span></p>
<div></div>
<div><img src="http://farm5.static.flickr.com/4101/4940749338_cbbdf8d40c_o.png" /></div>
<div></div>
<div>It might help if I had a map:</div>
<div><img height="212" src="http://farm5.static.flickr.com/4099/4940866502_9b682e73a1_o.png" width="320" /></div>
<div>
<p style="margin-bottom: 0.0001pt; line-height: normal; "><span style=" ;font-family:Arial, sans-serif;">On the map, the directions look pretty sensible, but what if there was a traffic jam on some streets and not others? How about a map that included traffic jams (i.e. bottlenecks)?</span></p>
<p style="margin-bottom: 0.0001pt; line-height: normal; "><span style=" ;font-family:Arial, sans-serif;">Whether the turn-by-turn directions are good or bad requires a map (i.e. visual information). So how do we get a map of for an SQL query? Let&#8217;s start with the terrain. We can describe the terrain by laying out the tables in the query graphically and drawing connectors for every join, or routes through the diagram. A diagram could look like this:</span></p>
</div>
<div></div>
<div><img height="254" src="http://farm5.static.flickr.com/4117/4943100206_a2182a2783_o.png" width="400" /></div>
<div></div>
<div>
<p style="margin-bottom: 0.0001pt; line-height: normal; "><span style=" ;font-family:Arial, sans-serif;">Now we have a map of the terrain. Seeing the terrain allows us to pick out an optimal explain plan. To pick an optimal explain plan, find tables that have the most selective filter and start the execution there. In the above case there is only one table with a filter. This filter is denoted by the F icon on the table BROKER. Start at BROKER and then look for joins that keep the running row set size to a minimum. The running row set size is the number of rows we carry from the previous node to the next node in the VST. We have to visit all the nodes, but the fewer rows we have to carry with us from one node to the next, the faster we’re going to arrive at our destination.</span></p>
<p style="margin-bottom: 0.0001pt; line-height: normal; "><span style=" ;font-family:Arial, sans-serif;"> Whether you draw out the VST by hand or use a tool, a best practice is to draw the child table above the parent table. This layout encourages us to navigate the VST join down to keep our running row set the same size vs. joining up which will generally increase the row set size:</span></p>
</div>
<div><img src="http://farm5.static.flickr.com/4138/4943967078_77fe5f7877_o.png" /></div>
<div></div>
<div>
<p style="margin-bottom: 0.0001pt; line-height: normal; "><span style=" ;font-family:Arial, sans-serif;">Thus, the idea is to start at the most selective filter and join down before joining up. In our example there is only one filter on BROKER, so we start there, we join down to OFFICE_LOCATION, then finish off with CLIENT_TRANSACTION, and end at CLIENT.</span></p>
<p style="margin-bottom: 0.0001pt; line-height: normal; "><span style=" ;font-family:Arial, sans-serif;">But what if we have more than one filter and we have to choose? In that case we have to calculate the filter percentage. The filter percentage is simply the number of filter rows divided by total rows in the table. Filter rows are the number of rows returned after applying the filter criteria on that table from the query.</span></p>
<p style="margin-bottom: 0.0001pt; line-height: normal; "><span style=" ;font-family:Arial, sans-serif;">In the diagram below, BROKER is the most selective filter at .05% so we start at BROKER and follow the same path as we just discussed:</span></p>
</div>
<div></div>
<div><img height="254" src="http://farm5.static.flickr.com/4097/4943025659_85120a6e93_o.png" width="400" /></div>
<div></div>
<div><span style=" ;font-family:Arial, sans-serif;">But what if we don’t have access to any information identifying the parent-child relationships (such as PK/FK constraints, unique indexes or unique constraints)? In those cases, we may be looking at many-to-many relationships.  With many-to-many relationships, it&#8217;s unclear how to navigate the VST. We no longer know whether to join up or down. To solve this impasse, we can add the two table join row sizes to help us navigate. Below, we’ve drawn the two table join sizes on the join lines:</span></div>
<div><img src="http://farm5.static.flickr.com/4085/4945562383_6aa7fa574b_b.jpg" /></div>
<div></div>
<div>T<span style=" ;font-family:Arial, sans-serif;">o navigate the VST above, we again start at BROKER with the most selective filter, then look for the smallest two table join size which is OFFICE_LOCATION with a join size of 3. Then we join to CLIENT_TRANSACTION and finally CLIENT.</span></div>
<p style="margin-bottom: 0.0001pt; line-height: normal; "><span style=" ;font-family:Arial, sans-serif;">As you can see, VST diagrams act like the map for the terrain that an SQL query has to navigate. When a simple map is not enough, we can add statistics such as filter percentages and two table join sizes to complete the map. VST diagrams can be drawn on paper, with tools such as Visio or with database products that draw them automatically using the SQL query, schema definitions and table statistics. </span></p>
<div>
<div></div>
</div>
<div>For more perspective on the visual approach to tuning SQL and drawing VST diagrams see</div>
<div><u>SQL Tuning</u> by Dan Tow</div>
<div><u>Refactoring SQL Applications</u> by Stephan Faroult , chapter 5</div>
<div>
<div>&#8220;Designing Efficient SQL: A Visual Approach&#8221; by Jonathan Lewis</div>
</div>
<div><span style=" color: rgb(51, 51, 51); line-height: 16px; font-family:Verdana, Arial, sans-serif;">      <a href="http://www.simple-talk.com/sql/performance/designing-efficient-sql-a-visual-approach/" rel="nofollow" style="color: rgb(51, 102, 153); outline-style: none; outline-width: initial; outline-color: initial; ">http://www.simple-talk.com/sql/performance/designing-efficient-sql-a-visual-approach/</a></span></div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p></b></span></p>
]]></content:encoded>
			<wfw:commentRss>http://dboptimizer.com/2010/09/10/sql-tuning-best-practice-%e2%80%93-visualizing-the-query/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
