<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Full Table Scan on A Blog on Oracle and Stuff</title>
    <link>https://enesi.no/tag/full-table-scan/</link>
    <description>Recent content in Full Table Scan on A Blog on Oracle and Stuff</description>
    <image>
      <title>A Blog on Oracle and Stuff</title>
      <url>https://enesi.no/images/enesi_logo.jpg</url>
      <link>https://enesi.no/images/enesi_logo.jpg</link>
    </image>
    <generator>Hugo</generator>
    <language>en</language>
    <copyright>Enesi Consulting AS</copyright>
    <lastBuildDate>Fri, 03 Jun 2011 18:32:00 +0200</lastBuildDate>
    <atom:link href="https://enesi.no/tag/full-table-scan/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Hidden updates - another reason to trace</title>
      <link>https://enesi.no/2011/06/hidden-updates-another-reason-to-trace/</link>
      <pubDate>Fri, 03 Jun 2011 18:32:00 +0200</pubDate>
      <guid>https://enesi.no/2011/06/hidden-updates-another-reason-to-trace/</guid>
      <description>&lt;p&gt;An insert or update statement that is taking a long time to complete is often working on the indexes belonging to the table rather than the table itself. If you look at the plan and finds nothing wrong, it is easy to forget that the indexes have to be updated as well.&lt;/p&gt;
&lt;p&gt;The solution as always when something takes time is to enable trace. When updating the indexes the trace file will usually show waits of type db file sequential read, and usually one block at the time.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>An insert or update statement that is taking a long time to complete is often working on the indexes belonging to the table rather than the table itself. If you look at the plan and finds nothing wrong, it is easy to forget that the indexes have to be updated as well.</p>
<p>The solution as always when something takes time is to enable trace. When updating the indexes the trace file will usually show waits of type db file sequential read, and usually one block at the time.</p>
<p>Full table scan normally causes db file scattered read with many blocks at the time. The number of blocks it fetches is limited, but not exclusively, by the parameter db_file_multiblock_read_count.</p>
<p>In other words, with lots of full table scans you expect db file scattered read but your GUI gives you db file sequential read. The trace file will show you what objects are causing waits and may remind you that the table has an index or two that you can drop and add later.</p>
<p>This command counts the number of waits of one type grouped by object_id (as in dba_objects):</p>
<pre tabindex="0"><code>  
grep &#34;db file sequential read&#34; FOOPROD_ora_6237.trc |awk &#39;{ print $12}&#39; |sort | uniq –c  
</code></pre><p>You can find total elapsed time (in seconds) for a specific object_id (106836 in this example) with:</p>
<pre tabindex="0"><code>  
awk &#39;/106836/ { ela += $8} END {print ela/1000000}&#39; FOOPROD_ora_6237.trc  
</code></pre><p>Repeat this for the object ids from the first list to find where most time is spent.</p>
<p>Then you can find the type and name of the object:</p>
<pre tabindex="0"><code>  
select object_type, object_name  
from dba_objects  
where object_id=106836;  
</code></pre><p>Of course a decent profiler will do this for you. I wrote this post to remind myself that the trace file will tell me what the fancy GUI hides for me. And it is kind of cool that on a mature OS a string of simple commands allow me to make my own ad-hoc profiler.</p>
]]></content:encoded>
    </item>
  </channel>
</rss>
