<?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>Oracle - Concepts et Exemples &#187; Plan d&rsquo;exécution</title>
	<atom:link href="https://blog.developpez.com/pachot/tag/plan-dexecution/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.developpez.com/pachot</link>
	<description>Les fonctionalités et concepts d&#039;Oracle à partir de traductions et de démos</description>
	<lastBuildDate>Sun, 03 Apr 2016 20:36:21 +0000</lastBuildDate>
	<language>fr-FR</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.42</generator>
	<item>
		<title>Afficher le plan d&#8217;exécution avec les stats de chaque étape</title>
		<link>https://blog.developpez.com/pachot/util_xplan_statistics/</link>
		<comments>https://blog.developpez.com/pachot/util_xplan_statistics/#comments</comments>
		<pubDate>Tue, 11 Jun 2013 10:40:41 +0000</pubDate>
		<dc:creator><![CDATA[pachot]]></dc:creator>
				<category><![CDATA[MicroLearning]]></category>
		<category><![CDATA[Plan d'exécution]]></category>

		<guid isPermaLink="false">http://blog.developpez.com/pachot/?p=130</guid>
		<description><![CDATA[Pour poster un plan d&#8217;exécution dans les forums, il est important de montrer les statistiques d&#8217;exécution et pas seulement les estimations &#8211; car s&#8217;il on a un problème c&#8217;est peut-être justement que les estimations sont fausses. Voici comment faire facilement &#8230; <a href="https://blog.developpez.com/pachot/util_xplan_statistics/">Lire la suite <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Pour poster un plan d&rsquo;exécution dans les forums, il est important de montrer les statistiques d&rsquo;exécution et pas seulement les estimations &#8211; car s&rsquo;il on a un problème c&rsquo;est peut-être justement que les estimations sont fausses. </p>
<p>Voici comment faire facilement sous sqlplus.</p>
<p><ins datetime="2013-06-11T10:29:02+00:00">Les exemples complets sont ici: <a href="http://ora-demo.pachot.net/util_xplan_statistics.html" title="demo" target="_blank">demo</a></ins><br />
<span id="more-130"></span><br />
<strong>1. On s&rsquo;assure que SQLPlus ne lance pas d&rsquo;autres requêtes</strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">set serveroutput off autotrace off</div></div>
<p>et que le format est lisible</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">set pagesize 1000 linesize 200 trimspool on</div></div>
<p><strong>2. On ajoute le hint GATHER_PLAN_STATISTICS et on exécute la requête:</strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">select /*+ GATHER_PLAN_STATISTICS */ level,ename,dname,sal from emp join dept using(deptno) connect by &nbsp;empno= prior mgr start with empno=7499 order by 1 desc;</div></div>
<table>
<tbody>
<tr>
<th scope="col">LEVEL
</th>
<th scope="col">ENAME
</th>
<th scope="col">DNAME
</th>
<th scope="col">SAL
</th>
</tr>
<tr>
<td align="right">         3
</td>
<td>KING
</td>
<td>ACCOUNTING
</td>
<td align="right">      5000
</td>
</tr>
<tr>
<td align="right">         2
</td>
<td>BLAKE
</td>
<td>SALES
</td>
<td align="right">      2850
</td>
</tr>
<tr>
<td align="right">         1
</td>
<td>ALLEN
</td>
<td>SALES
</td>
<td align="right">      1600
</td>
</tr>
</tbody>
</table>
<p><strong>3. On affiche les stats avec DBMS_XPLAN:</strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">select * from table(dbms_xplan.display_cursor(null,null,'allstats last'));</div></div>
<pre>   PLAN_TABLE_OUTPUT                                                                                                                
   SQL_ID 9uxp6bpf203yn, child number 0                                                                                             
   -------------------------------------                                                                                            
   select /*+ GATHER_PLAN_STATISTICS */ level,ename,dname,sal from emp                                                              
   join dept using(deptno) connect by empno= prior mgr start with                                                                   
   empno=7499 order by 1 desc                                                                                                       
                                                                                                                                    
   Plan hash value: 2206269999                                                                                                      
                                                                                                                                    
   -------------------------------------------------------------------------------------------------------------------------------- 
   | Id  | Operation                       | Name    | Starts | E-Rows | A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem | 
   -------------------------------------------------------------------------------------------------------------------------------- 
   |   0 | SELECT STATEMENT                |         |      1 |        |      3 |00:00:00.01 |      12 |       |       |          | 
   |   1 |  SORT ORDER BY                  |         |      1 |      2 |      3 |00:00:00.01 |      12 |  2048 |  2048 | 2048  (0)| 
   |*  2 |   CONNECT BY WITH FILTERING     |         |      1 |        |      3 |00:00:00.01 |      12 |  2048 |  2048 | 2048  (0)| 
   |   3 |    NESTED LOOPS                 |         |      1 |      1 |      1 |00:00:00.01 |       4 |       |       |          | 
   |   4 |     TABLE ACCESS BY INDEX ROWID | EMP     |      1 |      1 |      1 |00:00:00.01 |       2 |       |       |          | 
   |*  5 |      INDEX UNIQUE SCAN          | PK_EMP  |      1 |      1 |      1 |00:00:00.01 |       1 |       |       |          | 
   |   6 |     TABLE ACCESS BY INDEX ROWID | DEPT    |      1 |      1 |      1 |00:00:00.01 |       2 |       |       |          | 
   |*  7 |      INDEX UNIQUE SCAN          | PK_DEPT |      1 |      1 |      1 |00:00:00.01 |       1 |       |       |          | 
   |   8 |    NESTED LOOPS                 |         |      3 |      1 |      2 |00:00:00.01 |       8 |       |       |          | 
   |   9 |     NESTED LOOPS                |         |      3 |      1 |      2 |00:00:00.01 |       4 |       |       |          | 
   |  10 |      CONNECT BY PUMP            |         |      3 |        |      3 |00:00:00.01 |       0 |       |       |          | 
   |  11 |      TABLE ACCESS BY INDEX ROWID| EMP     |      3 |      1 |      2 |00:00:00.01 |       4 |       |       |          | 
   |* 12 |       INDEX UNIQUE SCAN         | PK_EMP  |      3 |      1 |      2 |00:00:00.01 |       2 |       |       |          | 
   |  13 |     TABLE ACCESS BY INDEX ROWID | DEPT    |      2 |      1 |      2 |00:00:00.01 |       4 |       |       |          | 
   |* 14 |      INDEX UNIQUE SCAN          | PK_DEPT |      2 |      1 |      2 |00:00:00.01 |       2 |       |       |          | 
   -------------------------------------------------------------------------------------------------------------------------------- 
                                                                                                                                    
   Predicate Information (identified by operation id):                                                                              
   ---------------------------------------------------                                                                              
                                                                                                                                    
   2 - access("EMPNO"=PRIOR NULL)                                                                                                   
   5 - access("EMP"."EMPNO"=7499)                                                                                                   
   7 - access("EMP"."DEPTNO"="DEPT"."DEPTNO")                                                                                       
   12 - access("EMP"."EMPNO"="connect$_by$_pump$_004"."prior mgr ")                                                                 
   14 - access("EMP"."DEPTNO"="DEPT"."DEPTNO")                                                                                      
                                                                                                                                    
   Note                                                                                                                             
   -----                                                                                                                            
   - dynamic statistics used: dynamic sampling (level=2)                                                                            
                                                                                                                                   
</pre>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
