 




<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Strange Oracle 9i behaviour</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/strange-oracle-9i-behaviour/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/strange-oracle-9i-behaviour/</link>
	<description></description>
	<lastBuildDate>Fri, 24 May 2013 04:11:53 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: carlosdl</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/strange-oracle-9i-behaviour/#comment-90165</link>
		<dc:creator>carlosdl</dc:creator>
		<pubDate>Mon, 28 Mar 2011 13:53:14 +0000</pubDate>
		<guid isPermaLink="false">#comment-90165</guid>
		<description><![CDATA[Thanks for the update, Darryn.]]></description>
		<content:encoded><![CDATA[<p>Thanks for the update, Darryn.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: darryn</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/strange-oracle-9i-behaviour/#comment-90142</link>
		<dc:creator>darryn</dc:creator>
		<pubDate>Mon, 28 Mar 2011 12:16:27 +0000</pubDate>
		<guid isPermaLink="false">#comment-90142</guid>
		<description><![CDATA[Quick update on the problem. We seem to have narrowed it down to Operating Systems. We changed the query to a quicker one, and when run from unix systems, it completed in under 60 secs, but took 45-60 mins from windows systems. We are struggling to find out why there is such a difference, and have opened  a case with metalink. One of our more experienced DBAs has concluded that the optimizer_mode=RULE is being forced from windows (he was able to produce the same explain plan and poor performance from unix by altering the session mode). There are no logon triggers or anything else we can find that is forcing the optimizer to use RULE, so now we are waiting on a response from Oracle.]]></description>
		<content:encoded><![CDATA[<p>Quick update on the problem. We seem to have narrowed it down to Operating Systems. We changed the query to a quicker one, and when run from unix systems, it completed in under 60 secs, but took 45-60 mins from windows systems. We are struggling to find out why there is such a difference, and have opened  a case with metalink. One of our more experienced DBAs has concluded that the optimizer_mode=RULE is being forced from windows (he was able to produce the same explain plan and poor performance from unix by altering the session mode). There are no logon triggers or anything else we can find that is forcing the optimizer to use RULE, so now we are waiting on a response from Oracle.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kccrosser</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/strange-oracle-9i-behaviour/#comment-89628</link>
		<dc:creator>kccrosser</dc:creator>
		<pubDate>Fri, 18 Mar 2011 18:32:19 +0000</pubDate>
		<guid isPermaLink="false">#comment-89628</guid>
		<description><![CDATA[&quot;poor performance throughout the database&quot; - this is a red flag for me.
I have often found that when you are having poor performance throughout, there are LOTS of underlying problems with tables, indexes, queries, and system configurations.

This leads to a problem in tuning, since you might fix one problem and not see an improvement in system performance, so it seems like your fix didn&#039;t work.  Often the system is really overloaded/choked - if it is trying to run with 130% load, and you take out a 10% problem, the system is still trying to run at a 120% load, and everything still runs slow.

To address these, I use that query I posted earlier and start working down through the &quot;worst of the worst&quot; - looking at each query to determine what is causing it to behave badly.  In one large system, I had to fix over 30 queries (mostly by adding/changing indexes) before the system dropped out of saturation mode and started being responsive to further improvements.

The Disk I/O and Buffer Get numbers suggest that the system is doing some serious table (or index) scanning, and that the data of interest isn&#039;t cached, so it needs to hit the disk.  This implies that the indexes aren&#039;t efficient, and may explain why the optimizer doesn&#039;t choose to use some of the indexes.

Are you using &quot;covering&quot; indexes?  (Indexes where the index itself contains the column(s) being retrieved based on the key values.)  These can seriously improve system performance, as the system can often avoid fetching the actual data row if the desired retrieval value is in the index.  Sometimes a modest increase in the size of an index can cut performance by 10x or more.

I would start looking at the overall systems performance issues before focusing on this particular query.  40 minutes to retrieve 900 rows seems excessive by itself - that is the kind of performance time I would expect for a monthly detail financial report for a large corporation.]]></description>
		<content:encoded><![CDATA[<p>&#8220;poor performance throughout the database&#8221; &#8211; this is a red flag for me.<br />
I have often found that when you are having poor performance throughout, there are LOTS of underlying problems with tables, indexes, queries, and system configurations.</p>
<p>This leads to a problem in tuning, since you might fix one problem and not see an improvement in system performance, so it seems like your fix didn&#8217;t work.  Often the system is really overloaded/choked &#8211; if it is trying to run with 130% load, and you take out a 10% problem, the system is still trying to run at a 120% load, and everything still runs slow.</p>
<p>To address these, I use that query I posted earlier and start working down through the &#8220;worst of the worst&#8221; &#8211; looking at each query to determine what is causing it to behave badly.  In one large system, I had to fix over 30 queries (mostly by adding/changing indexes) before the system dropped out of saturation mode and started being responsive to further improvements.</p>
<p>The Disk I/O and Buffer Get numbers suggest that the system is doing some serious table (or index) scanning, and that the data of interest isn&#8217;t cached, so it needs to hit the disk.  This implies that the indexes aren&#8217;t efficient, and may explain why the optimizer doesn&#8217;t choose to use some of the indexes.</p>
<p>Are you using &#8220;covering&#8221; indexes?  (Indexes where the index itself contains the column(s) being retrieved based on the key values.)  These can seriously improve system performance, as the system can often avoid fetching the actual data row if the desired retrieval value is in the index.  Sometimes a modest increase in the size of an index can cut performance by 10x or more.</p>
<p>I would start looking at the overall systems performance issues before focusing on this particular query.  40 minutes to retrieve 900 rows seems excessive by itself &#8211; that is the kind of performance time I would expect for a monthly detail financial report for a large corporation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: paladine solamnia</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/strange-oracle-9i-behaviour/#comment-89556</link>
		<dc:creator>paladine solamnia</dc:creator>
		<pubDate>Thu, 17 Mar 2011 17:51:33 +0000</pubDate>
		<guid isPermaLink="false">#comment-89556</guid>
		<description><![CDATA[&lt;i&gt;We are experiencing poor performance throughout the database, we are just using this query as a test.&lt;/i&gt;

Hmm, any changes to the database server recently such as a migration request to some schemas or some parameter changes or even hardware changes ? I mean things don&#039;t happen out of a sudden if this server has been going on fine for the last few weeks/months. Are there any batch jobs that run over the night doing lots of DML operations such as inserts, deletes and updates?

Any reasons why this query in particular ? Is it because it appeared in the top 10 SQL statements in your Statspack reports ? Btw, I think the buffer gets are really off the charts. Thats why the query is so slow.

&lt;i&gt; I thought I might have made a mistake, so I started again (killed sessions, closed sql+), &lt;/i&gt;

Personally, I think if the problem resides purely in your database server, there is no need to test the queries on the database server (locally) and on another machine a hop away. (Thanks Carlosdl for pointing that out) 
Just do all the sqlplus sessions locally on the database server. Is this machine a critical production database ? If not, you might want to do the following to get a &quot;cleaner&quot; reading for explain plan instead of just kill sessions.

SQL&gt; alter system flush shared_pool;
SQL&gt; alter system checkpoint;
SQL&gt; alter session set events = &#039;immediate trace name flush_cache&#039;;


I don&#039;t really fancy SQL tuning since you said that it&#039;s poor performance throughout the database but having said that I think if this query is important, perhaps tuning it as an interim solution is better than no solution at all.

&lt;i&gt;The execution plan has only slightly changed though, with 1 index from a table being used in place of another&lt;/i&gt;

I&#039;m of the opinion you need to take a look at the clustering factor of the indexes in question. On top of that, another back to basics review of the indexes in question should be based on the following questions :

1) How many distinct values in that particular column of the table that was indexed are we talking about? If the number of distinct values is very low and the index used is a normal B-Tree index, it would make more sense to use a bit-map index instead on columns such as Gender i.e. Male/Female.

2) Are there lots of NULL values in that particuar column that was indexed ? If there are, chances are that index wouldn&#039;t be utilized no matter how hard you try as the index is invalidated the minute it encounters NULL. Try using a function based index on a nvl(&lt;NULL columnn&gt;, &lt;some value&gt;) function to convert the NULL value to something instead. That is the silver bullet that burleson always preach.

3) Are your indexes composite indexes i.e. indexes placed on several columns ? If they are, the order of the columns by which your composite index is placed play a part in the attractiveness of the index to the optimizer.

The only other thing I can think of is to rebuild all the indexes. That would certainly help but given that the data in the tables are so huge, the rebuild might take a lot of time.]]></description>
		<content:encoded><![CDATA[<p><i>We are experiencing poor performance throughout the database, we are just using this query as a test.</i></p>
<p>Hmm, any changes to the database server recently such as a migration request to some schemas or some parameter changes or even hardware changes ? I mean things don&#8217;t happen out of a sudden if this server has been going on fine for the last few weeks/months. Are there any batch jobs that run over the night doing lots of DML operations such as inserts, deletes and updates?</p>
<p>Any reasons why this query in particular ? Is it because it appeared in the top 10 SQL statements in your Statspack reports ? Btw, I think the buffer gets are really off the charts. Thats why the query is so slow.</p>
<p><i> I thought I might have made a mistake, so I started again (killed sessions, closed sql+), </i></p>
<p>Personally, I think if the problem resides purely in your database server, there is no need to test the queries on the database server (locally) and on another machine a hop away. (Thanks Carlosdl for pointing that out)<br />
Just do all the sqlplus sessions locally on the database server. Is this machine a critical production database ? If not, you might want to do the following to get a &#8220;cleaner&#8221; reading for explain plan instead of just kill sessions.</p>
<p>SQL&gt; alter system flush shared_pool;<br />
SQL&gt; alter system checkpoint;<br />
SQL&gt; alter session set events = &#8216;immediate trace name flush_cache&#8217;;</p>
<p>I don&#8217;t really fancy SQL tuning since you said that it&#8217;s poor performance throughout the database but having said that I think if this query is important, perhaps tuning it as an interim solution is better than no solution at all.</p>
<p><i>The execution plan has only slightly changed though, with 1 index from a table being used in place of another</i></p>
<p>I&#8217;m of the opinion you need to take a look at the clustering factor of the indexes in question. On top of that, another back to basics review of the indexes in question should be based on the following questions :</p>
<p>1) How many distinct values in that particular column of the table that was indexed are we talking about? If the number of distinct values is very low and the index used is a normal B-Tree index, it would make more sense to use a bit-map index instead on columns such as Gender i.e. Male/Female.</p>
<p>2) Are there lots of NULL values in that particuar column that was indexed ? If there are, chances are that index wouldn&#8217;t be utilized no matter how hard you try as the index is invalidated the minute it encounters NULL. Try using a function based index on a nvl(&lt;NULL columnn&gt;, &lt;some value&gt;) function to convert the NULL value to something instead. That is the silver bullet that burleson always preach.</p>
<p>3) Are your indexes composite indexes i.e. indexes placed on several columns ? If they are, the order of the columns by which your composite index is placed play a part in the attractiveness of the index to the optimizer.</p>
<p>The only other thing I can think of is to rebuild all the indexes. That would certainly help but given that the data in the tables are so huge, the rebuild might take a lot of time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: carlosdl</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/strange-oracle-9i-behaviour/#comment-89538</link>
		<dc:creator>carlosdl</dc:creator>
		<pubDate>Thu, 17 Mar 2011 13:48:03 +0000</pubDate>
		<guid isPermaLink="false">#comment-89538</guid>
		<description><![CDATA[&lt;i&gt;1) Are the servers hardware in terms of CPU and memory allocation for your various SGA, DB buffer cache, shared pool, etc identical ?

3) Is the amount of data in the tables queried identical ?&lt;/i&gt;

Paladine Solamnia:  The same query is being run against the same database (on the same database server), but &lt;b&gt;from &lt;/b&gt;different servers.]]></description>
		<content:encoded><![CDATA[<p><i>1) Are the servers hardware in terms of CPU and memory allocation for your various SGA, DB buffer cache, shared pool, etc identical ?</p>
<p>3) Is the amount of data in the tables queried identical ?</i></p>
<p>Paladine Solamnia:  The same query is being run against the same database (on the same database server), but <b>from </b>different servers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: darryn</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/strange-oracle-9i-behaviour/#comment-89533</link>
		<dc:creator>darryn</dc:creator>
		<pubDate>Thu, 17 Mar 2011 10:51:58 +0000</pubDate>
		<guid isPermaLink="false">#comment-89533</guid>
		<description><![CDATA[Sorry, posted in the wrong area:

&lt;i&gt;1) Are the servers hardware in terms of CPU and memory allocation for your various SGA, DB buffer cache, shared pool, etc identical ? Are you using Automatic Memory Management, btw ?&lt;/i&gt;
We have the pga_aggregate_target set to 3758096384 and the workarea_size_policy set to AUTO.]]></description>
		<content:encoded><![CDATA[<p>Sorry, posted in the wrong area:</p>
<p><i>1) Are the servers hardware in terms of CPU and memory allocation for your various SGA, DB buffer cache, shared pool, etc identical ? Are you using Automatic Memory Management, btw ?</i><br />
We have the pga_aggregate_target set to 3758096384 and the workarea_size_policy set to AUTO.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: darryn</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/strange-oracle-9i-behaviour/#comment-89531</link>
		<dc:creator>darryn</dc:creator>
		<pubDate>Thu, 17 Mar 2011 10:35:53 +0000</pubDate>
		<guid isPermaLink="false">#comment-89531</guid>
		<description><![CDATA[Hi Paladine

&lt;i&gt;1) Are the servers hardware in terms of CPU and memory allocation for your various SGA, DB buffer cache, shared pool, etc identical ? Are you using Automatic Memory Management, btw ?&lt;/i&gt; 
I&#039;m not sure, I will need to check.

&lt;i&gt;2) You said the explain plans are the same except the costs. Which component in the explain plan is different with respect to the cost? Is it the index, the join, the full table scans or the index scans ?&lt;/i&gt;
E.g. 
Adj100 - Table access by local index row id - cost 226,644; cpu_cost 9,219,635,858; io_cost 225,960
             - Index Range Scan - cost 1,517, cpu_cost 216,554,762; io_cost 1,500

Adj10 - Table access by local index row id - cost 78,757; cpu_cost 921,963,586; io_cost 78,689
           - Index Range Scan - cost 1,517, cpu_cost 216,554,762; io_cost 1,500


&lt;i&gt;3) Is the amount of data in the tables queried identical ? This has a big impact on how the optimizer plans its execution. For instance, querying against a small table would yield better performance if a full table scan is used while an index scan would be ideal if only 5% of the table rows are to be returned.&lt;/i&gt;
Yes, they are all fairly large tables (375 mil, 113 mil, 84 mil, 3 mil). I noticed the change in performance yesterday when a different index was chosen on the 375 mil table (there are only 2 indexes on the table). The other indexes are direct table-&gt;table joins, so no full table scans are done in the query.

&lt;i&gt;4) I cannot emphasise this more often than I would but it is imperative that the statistics for the tables in the query along with any related indexes are accrued correctly in the form of high-quality statistics. I’ve seen the performance of queries degrade badly ‘cos the statistics are not updated and skewed badly. At the very least, try querying against dba_tables and dba_segments using this query I wrote to ascertain when the statistics are last updated:&lt;/i&gt;
Our stats are updated every weekend, and I have checked that they were throughout the process.

Note:- We are experiencing poor performance throughout the database, we are just using this query as a test.]]></description>
		<content:encoded><![CDATA[<p>Hi Paladine</p>
<p><i>1) Are the servers hardware in terms of CPU and memory allocation for your various SGA, DB buffer cache, shared pool, etc identical ? Are you using Automatic Memory Management, btw ?</i><br />
I&#8217;m not sure, I will need to check.</p>
<p><i>2) You said the explain plans are the same except the costs. Which component in the explain plan is different with respect to the cost? Is it the index, the join, the full table scans or the index scans ?</i><br />
E.g.<br />
Adj100 &#8211; Table access by local index row id &#8211; cost 226,644; cpu_cost 9,219,635,858; io_cost 225,960<br />
             &#8211; Index Range Scan &#8211; cost 1,517, cpu_cost 216,554,762; io_cost 1,500</p>
<p>Adj10 &#8211; Table access by local index row id &#8211; cost 78,757; cpu_cost 921,963,586; io_cost 78,689<br />
           &#8211; Index Range Scan &#8211; cost 1,517, cpu_cost 216,554,762; io_cost 1,500</p>
<p><i>3) Is the amount of data in the tables queried identical ? This has a big impact on how the optimizer plans its execution. For instance, querying against a small table would yield better performance if a full table scan is used while an index scan would be ideal if only 5% of the table rows are to be returned.</i><br />
Yes, they are all fairly large tables (375 mil, 113 mil, 84 mil, 3 mil). I noticed the change in performance yesterday when a different index was chosen on the 375 mil table (there are only 2 indexes on the table). The other indexes are direct table-&gt;table joins, so no full table scans are done in the query.</p>
<p><i>4) I cannot emphasise this more often than I would but it is imperative that the statistics for the tables in the query along with any related indexes are accrued correctly in the form of high-quality statistics. I’ve seen the performance of queries degrade badly ‘cos the statistics are not updated and skewed badly. At the very least, try querying against dba_tables and dba_segments using this query I wrote to ascertain when the statistics are last updated:</i><br />
Our stats are updated every weekend, and I have checked that they were throughout the process.</p>
<p>Note:- We are experiencing poor performance throughout the database, we are just using this query as a test.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: darryn</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/strange-oracle-9i-behaviour/#comment-89529</link>
		<dc:creator>darryn</dc:creator>
		<pubDate>Thu, 17 Mar 2011 09:42:05 +0000</pubDate>
		<guid isPermaLink="false">#comment-89529</guid>
		<description><![CDATA[This is now very wierd (16/03). We tested the cost_adjustment at 100 last week, and it didn&#039;t improve the performance of the query, however, I have retested it this week (yesterday and today), and the query ran in the normal time (40 mins). The execution plan has only slightly changed though, with 1 index from a table being used in place of another (the plan for the adjustment = 10 is still the same). Our stats are usually updated over the weekend (I have checked, and they were updated this weekend), so the statistics should not have been stale (although I know plans can change with the stats update). 
-(Update 17/03) - This is certainly strange, and I don&#039;t know if I am going mad. I have set off the query with both optimizer adj = 100 and 10 this morning (2 sql+ sessions). Both explain plans are exactly the same in all aspects, cost and plan, both the same as with the previous optimizer adj = 100. I thought I might have made a mistake, so I started again (killed sessions, closed sql+), but now both explain plans have reverted to the cost adj = 10. Double checked this by opening another sql+ window, set the cost adj =100, and it is the same as the 10?????

Could it be that we have a problem with our optimizer?

&quot;&lt;i&gt;Setting the optimizer_index_cost_adj value to 10 effectively forces the optimizer to try to use indexes even when a full table scan may be a lot more efficient&lt;/i&gt;.&quot;

Yes, we were trying to force the optimizer to use the indexes, as we noticed that our indexes weren&#039;t being used when they should be (that is a another problem, although related). When we used hints to use the indexes, the queries ran far quicker than the ones that did full table scans, which is why we set the index cost adjustment.

&lt;i&gt;&quot; I have used the following to look at the query activity&quot;&lt;/i&gt;

As this is a reporting database, both the disk and buffer fetches are high (running the query returns almost 900 rows). If I run it for just the query in question, with the queries started 1.5 mins apart (both with same explain_plan), I get the following:

       EXES      DISK      DISK/EXE        GETS           GETS/EXE
1)       2        115198      57599        7468269          3734134
2)       4        165601      41400        8963173          2240793

I think we need a new database.......]]></description>
		<content:encoded><![CDATA[<p>This is now very wierd (16/03). We tested the cost_adjustment at 100 last week, and it didn&#8217;t improve the performance of the query, however, I have retested it this week (yesterday and today), and the query ran in the normal time (40 mins). The execution plan has only slightly changed though, with 1 index from a table being used in place of another (the plan for the adjustment = 10 is still the same). Our stats are usually updated over the weekend (I have checked, and they were updated this weekend), so the statistics should not have been stale (although I know plans can change with the stats update).<br />
-(Update 17/03) &#8211; This is certainly strange, and I don&#8217;t know if I am going mad. I have set off the query with both optimizer adj = 100 and 10 this morning (2 sql+ sessions). Both explain plans are exactly the same in all aspects, cost and plan, both the same as with the previous optimizer adj = 100. I thought I might have made a mistake, so I started again (killed sessions, closed sql+), but now both explain plans have reverted to the cost adj = 10. Double checked this by opening another sql+ window, set the cost adj =100, and it is the same as the 10?????</p>
<p>Could it be that we have a problem with our optimizer?</p>
<p>&#8220;<i>Setting the optimizer_index_cost_adj value to 10 effectively forces the optimizer to try to use indexes even when a full table scan may be a lot more efficient</i>.&#8221;</p>
<p>Yes, we were trying to force the optimizer to use the indexes, as we noticed that our indexes weren&#8217;t being used when they should be (that is a another problem, although related). When we used hints to use the indexes, the queries ran far quicker than the ones that did full table scans, which is why we set the index cost adjustment.</p>
<p><i>&#8221; I have used the following to look at the query activity&#8221;</i></p>
<p>As this is a reporting database, both the disk and buffer fetches are high (running the query returns almost 900 rows). If I run it for just the query in question, with the queries started 1.5 mins apart (both with same explain_plan), I get the following:</p>
<p>       EXES      DISK      DISK/EXE        GETS           GETS/EXE<br />
1)       2        115198      57599        7468269          3734134<br />
2)       4        165601      41400        8963173          2240793</p>
<p>I think we need a new database&#8230;&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Featured Member: Darryn - ITKE Community Blog</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/strange-oracle-9i-behaviour/#comment-89518</link>
		<dc:creator>Featured Member: Darryn - ITKE Community Blog</dc:creator>
		<pubDate>Thu, 17 Mar 2011 07:00:15 +0000</pubDate>
		<guid isPermaLink="false">#comment-89518</guid>
		<description><![CDATA[[...] Strange Oracle 9i behaviour [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Strange Oracle 9i behaviour [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: paladine solamnia</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/strange-oracle-9i-behaviour/#comment-89511</link>
		<dc:creator>paladine solamnia</dc:creator>
		<pubDate>Thu, 17 Mar 2011 02:29:25 +0000</pubDate>
		<guid isPermaLink="false">#comment-89511</guid>
		<description><![CDATA[Hi Darryn,

I think the easiest way to troubleshoot is to find out what is the main difference between both your servers S1 and S2. As what kccrosser suggested, try setting your optimizer_index_cost_adj back to the default value of 100. Ceteris Paribus, you should probably ask yourself the following:

1) Are the servers hardware in terms of CPU and memory allocation for your various SGA, DB buffer cache, shared pool, etc identical ? Are you using Automatic Memory Management, btw ?

2) You said the explain plans are the same except the costs. Which component in the explain plan is different with respect to the cost? Is it the index, the join, the full table scans or the index scans ?

3) Is the amount of data in the tables queried identical ? This has a big impact on how the optimizer plans its execution. For instance, querying against a small table would yield better performance if a full table scan is used while an index scan would be ideal if only 5% of the table rows are to be returned.

4) I cannot emphasise this more often than I would but it is imperative that the statistics for the tables in the query along with any related indexes are accrued correctly in the form of high-quality statistics. I&#039;ve seen the performance of queries degrade badly &#039;cos the statistics are not updated and skewed badly. At the very least, try querying against dba_tables and dba_segments using this query I wrote to ascertain when the statistics are last updated:

set pagesize 1000
set linesize 300

spool ana_progress.log

alter session set NLS_DATE_FORMAT=&#039;DD-MON-YYYY HH24:MI:SS&#039;;

select a.owner, a.table_name, b.partition_name, a.last_analyzed
from dba_tables a, dba_segments b
where a.table_name = b.segment_name
and a.owner = b.owner
and a.owner in(&#039;&lt;owner&gt;&#039;)
order by 1,2;

spool off

Similarly, query against the dba_indexes and their last_analyzed to see any differences.
If there are any discrepancies, run the following against the tables in your query:

execute dbms_stats.gather_table_stats(tabname=&gt;&#039;&lt;table_name&gt;&#039;,ownname=&gt;&#039;&lt;owner&gt;&#039;,cascade=&gt;TRUE);

I hope this helps.]]></description>
		<content:encoded><![CDATA[<p>Hi Darryn,</p>
<p>I think the easiest way to troubleshoot is to find out what is the main difference between both your servers S1 and S2. As what kccrosser suggested, try setting your optimizer_index_cost_adj back to the default value of 100. Ceteris Paribus, you should probably ask yourself the following:</p>
<p>1) Are the servers hardware in terms of CPU and memory allocation for your various SGA, DB buffer cache, shared pool, etc identical ? Are you using Automatic Memory Management, btw ?</p>
<p>2) You said the explain plans are the same except the costs. Which component in the explain plan is different with respect to the cost? Is it the index, the join, the full table scans or the index scans ?</p>
<p>3) Is the amount of data in the tables queried identical ? This has a big impact on how the optimizer plans its execution. For instance, querying against a small table would yield better performance if a full table scan is used while an index scan would be ideal if only 5% of the table rows are to be returned.</p>
<p>4) I cannot emphasise this more often than I would but it is imperative that the statistics for the tables in the query along with any related indexes are accrued correctly in the form of high-quality statistics. I&#8217;ve seen the performance of queries degrade badly &#8216;cos the statistics are not updated and skewed badly. At the very least, try querying against dba_tables and dba_segments using this query I wrote to ascertain when the statistics are last updated:</p>
<p>set pagesize 1000<br />
set linesize 300</p>
<p>spool ana_progress.log</p>
<p>alter session set NLS_DATE_FORMAT=&#8217;DD-MON-YYYY HH24:MI:SS&#8217;;</p>
<p>select a.owner, a.table_name, b.partition_name, a.last_analyzed<br />
from dba_tables a, dba_segments b<br />
where a.table_name = b.segment_name<br />
and a.owner = b.owner<br />
and a.owner in(&#8216;&lt;owner&gt;&#8217;)<br />
order by 1,2;</p>
<p>spool off</p>
<p>Similarly, query against the dba_indexes and their last_analyzed to see any differences.<br />
If there are any discrepancies, run the following against the tables in your query:</p>
<p>execute dbms_stats.gather_table_stats(tabname=&gt;&#8217;&lt;table_name&gt;&#8217;,ownname=&gt;&#8217;&lt;owner&gt;&#8217;,cascade=&gt;TRUE);</p>
<p>I hope this helps.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 6/8 queries in 0.011 seconds using memcached
Object Caching 395/396 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-24 05:49:11 -->