<?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: Tuning Oracle for Siebel &#8211; SQL template</title>
	<atom:link href="http://www.adellera.it/blog/2009/06/30/tuning-oracle-for-siebel-sql-template/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.adellera.it/blog/2009/06/30/tuning-oracle-for-siebel-sql-template/</link>
	<description>A blog about Oracle - Un blog riguardo Oracle</description>
	<lastBuildDate>Mon, 14 Nov 2011 11:12:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Samir</title>
		<link>http://www.adellera.it/blog/2009/06/30/tuning-oracle-for-siebel-sql-template/comment-page-1/#comment-314</link>
		<dc:creator>Samir</dc:creator>
		<pubDate>Wed, 10 Feb 2010 18:59:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.adellera.it/blog/?p=267#comment-314</guid>
		<description>Alberto, 

Thanks - yes i agree with you about FIRST_ROWS_10, however, when the CBO calculates cost to get back the first 10 rows of the statement as fast as it can, it can grossly underestimate the # of rows for some key steps. Example, for the 1st predicate it uses an index range scan for that step, the CBO estimates only 10 records need to be scanned. But when running the query it goes through thousands of records as that is what it ends up taking get 10 rows which satisfy the 2nd predicate as well. I did find a potential solution for this though - even though i am mostly working at the query and database level, i discovered that in the siebel application, you can set something at the business-component level which will hint queries in that BC with an ALL_ROWS hint. That can fix some queries with this sort issue. I&#039;m trying to get my siebel developers to look into this, as we are experiencing this issue all over the place.</description>
		<content:encoded><![CDATA[<p>Alberto, </p>
<p>Thanks &#8211; yes i agree with you about FIRST_ROWS_10, however, when the CBO calculates cost to get back the first 10 rows of the statement as fast as it can, it can grossly underestimate the # of rows for some key steps. Example, for the 1st predicate it uses an index range scan for that step, the CBO estimates only 10 records need to be scanned. But when running the query it goes through thousands of records as that is what it ends up taking get 10 rows which satisfy the 2nd predicate as well. I did find a potential solution for this though &#8211; even though i am mostly working at the query and database level, i discovered that in the siebel application, you can set something at the business-component level which will hint queries in that BC with an ALL_ROWS hint. That can fix some queries with this sort issue. I&#8217;m trying to get my siebel developers to look into this, as we are experiencing this issue all over the place.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alberto Dell'Era</title>
		<link>http://www.adellera.it/blog/2009/06/30/tuning-oracle-for-siebel-sql-template/comment-page-1/#comment-313</link>
		<dc:creator>Alberto Dell'Era</dc:creator>
		<pubDate>Wed, 10 Feb 2010 18:15:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.adellera.it/blog/?p=267#comment-313</guid>
		<description>@Samir

sorry, I have seen your comment only today, probably I have an issue with email notifications ...

The main issue with Siebel is that some &quot;supported settings&quot; are just there to kill the CBO. For example, setting OPTIMIZER_INDEX_COST_ADJ to 1 makes the cost of index access so tiny, that it really makes them so unrealistically cheap that the CBO basically miscalculates the cost completely ... if memory serves right you have, in recent version, the opportunity to set it to the default (100) hence allowing the CBO to make its work much better. You could try it and see whether that makes any difference.

The second is that very often, if the predicates on the N tables are not selective enough, there&#039;s no way that a nested loop could get them back efficiently - whatever table you choose as the driving table(s), it makes for a lot of index accesses on the inner tables(s). An hash join (or sort merge) would be optimal, but Siebel blocks them ...

Of course to remedy the situation, you might be forced to drop the index on the ordered-by columns ... possibly killing other queries. At the end, in Siebel, poor database performance has to be accepted as a fact of life almost always :(  

PS: FIRST_ROWS_10 means asking the CBO to get back the first 10 rows of the statement as fast as it can, not the first 10 rows of each step.</description>
		<content:encoded><![CDATA[<p>@Samir</p>
<p>sorry, I have seen your comment only today, probably I have an issue with email notifications &#8230;</p>
<p>The main issue with Siebel is that some &#8220;supported settings&#8221; are just there to kill the CBO. For example, setting OPTIMIZER_INDEX_COST_ADJ to 1 makes the cost of index access so tiny, that it really makes them so unrealistically cheap that the CBO basically miscalculates the cost completely &#8230; if memory serves right you have, in recent version, the opportunity to set it to the default (100) hence allowing the CBO to make its work much better. You could try it and see whether that makes any difference.</p>
<p>The second is that very often, if the predicates on the N tables are not selective enough, there&#8217;s no way that a nested loop could get them back efficiently &#8211; whatever table you choose as the driving table(s), it makes for a lot of index accesses on the inner tables(s). An hash join (or sort merge) would be optimal, but Siebel blocks them &#8230;</p>
<p>Of course to remedy the situation, you might be forced to drop the index on the ordered-by columns &#8230; possibly killing other queries. At the end, in Siebel, poor database performance has to be accepted as a fact of life almost always :(  </p>
<p>PS: FIRST_ROWS_10 means asking the CBO to get back the first 10 rows of the statement as fast as it can, not the first 10 rows of each step.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Samir</title>
		<link>http://www.adellera.it/blog/2009/06/30/tuning-oracle-for-siebel-sql-template/comment-page-1/#comment-312</link>
		<dc:creator>Samir</dc:creator>
		<pubDate>Thu, 04 Feb 2010 17:44:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.adellera.it/blog/?p=267#comment-312</guid>
		<description>Hello, 

Nice post - i just saw this the first time. However i think there are issues in my environment which are related to your post somewhat, but different. The vanilla queries coming out of siebel are as you mentioned, from what i can see. However the customizations that are often done to them are causing issues, I believe. Many screens in our environment seem to have multiple base tables, not just one. For example, a query on accounts may select for the business unit from S_ORG_BU (of which there are only 1 or 2, so this will match alot of records), but then the developers cater this query for a team, to search by a national account number, using a custom column from the accounts table. But the ORDER BY stayed on the business unit, so oracle really loves that index on the S_ORG_BU table, so it can fetch the first 10 rows quickly as you said. But the problem is, as it is fetching the 10 rows they then are matched against the other predicate on the other ACCOUNTS table S_ORG_EXT. If the row doesn&#039;t satisfy that 2nd predicate, it must scan the next row on S_ORG_BU and try again. This can keep happening until it may end up scanning hundreds of thousands of rows until it finds 10 which match the 2nd predicate, and return them to the user. Response time can be horrible because of this. See below for an example. Even though an index exists on the X_NATIONAL_ACCOUNT_NUMBER table, the CBO doesn&#039;t pick it up as the column is not very selective. Each national account matches a few hundred rows in that table, but this is FAR better than using the S_ORG_BU index, which matches hundreds of thousands of rows. But the CBO likes the latter, because it is thinking FIRST_ROWS_10, that it only will fetch 10 rows from each step. Seems the CBO doesn&#039;t realize that it will scan many more rows than 10, to satisfy the 2nd predicate on S_ORG_EXT table...

SELECT ...
FROM SIEBEL.S_ORG_BU T1,
...
   SIEBEL.S_ORG_EXT T27
WHERE ....
AND T1.BU_ID = :1
AND T27.ROW_ID = T1.ORG_ID
AND T1.BU_ID = T8.ROW_ID
AND T1.BU_ID = T6.PAR_ROW_ID (+)
AND (T1.ORG_NAME &gt;= :2)
AND (T27.X_NATIONAL_ACCOUNT_NUMBER = :3)
ORDER BY T1.BU_ID,
   T1.ORG_NAME,
   T1.ORG_LOC</description>
		<content:encoded><![CDATA[<p>Hello, </p>
<p>Nice post &#8211; i just saw this the first time. However i think there are issues in my environment which are related to your post somewhat, but different. The vanilla queries coming out of siebel are as you mentioned, from what i can see. However the customizations that are often done to them are causing issues, I believe. Many screens in our environment seem to have multiple base tables, not just one. For example, a query on accounts may select for the business unit from S_ORG_BU (of which there are only 1 or 2, so this will match alot of records), but then the developers cater this query for a team, to search by a national account number, using a custom column from the accounts table. But the ORDER BY stayed on the business unit, so oracle really loves that index on the S_ORG_BU table, so it can fetch the first 10 rows quickly as you said. But the problem is, as it is fetching the 10 rows they then are matched against the other predicate on the other ACCOUNTS table S_ORG_EXT. If the row doesn&#8217;t satisfy that 2nd predicate, it must scan the next row on S_ORG_BU and try again. This can keep happening until it may end up scanning hundreds of thousands of rows until it finds 10 which match the 2nd predicate, and return them to the user. Response time can be horrible because of this. See below for an example. Even though an index exists on the X_NATIONAL_ACCOUNT_NUMBER table, the CBO doesn&#8217;t pick it up as the column is not very selective. Each national account matches a few hundred rows in that table, but this is FAR better than using the S_ORG_BU index, which matches hundreds of thousands of rows. But the CBO likes the latter, because it is thinking FIRST_ROWS_10, that it only will fetch 10 rows from each step. Seems the CBO doesn&#8217;t realize that it will scan many more rows than 10, to satisfy the 2nd predicate on S_ORG_EXT table&#8230;</p>
<p>SELECT &#8230;<br />
FROM SIEBEL.S_ORG_BU T1,<br />
&#8230;<br />
   SIEBEL.S_ORG_EXT T27<br />
WHERE &#8230;.<br />
AND T1.BU_ID = :1<br />
AND T27.ROW_ID = T1.ORG_ID<br />
AND T1.BU_ID = T8.ROW_ID<br />
AND T1.BU_ID = T6.PAR_ROW_ID (+)<br />
AND (T1.ORG_NAME &gt;= :2)<br />
AND (T27.X_NATIONAL_ACCOUNT_NUMBER = :3)<br />
ORDER BY T1.BU_ID,<br />
   T1.ORG_NAME,<br />
   T1.ORG_LOC</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alberto Dell'Era</title>
		<link>http://www.adellera.it/blog/2009/06/30/tuning-oracle-for-siebel-sql-template/comment-page-1/#comment-74</link>
		<dc:creator>Alberto Dell'Era</dc:creator>
		<pubDate>Thu, 23 Jul 2009 09:32:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.adellera.it/blog/?p=267#comment-74</guid>
		<description>@Alex

Thank you for your contribution - that is definitely something that must be always remembered when &quot;tuning&quot; Siebel.  Actually in our case, the database schema is so heavily customized (manually partitioned tables, a lot of indexes using options such as &quot;compress&quot; etc) that everything is pretty much done by hand ... Siebel is synchronized somehow, but I do not know exactly how since I&#039;m not the one in charge of this :)</description>
		<content:encoded><![CDATA[<p>@Alex</p>
<p>Thank you for your contribution &#8211; that is definitely something that must be always remembered when &#8220;tuning&#8221; Siebel.  Actually in our case, the database schema is so heavily customized (manually partitioned tables, a lot of indexes using options such as &#8220;compress&#8221; etc) that everything is pretty much done by hand &#8230; Siebel is synchronized somehow, but I do not know exactly how since I&#8217;m not the one in charge of this :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: @lex</title>
		<link>http://www.adellera.it/blog/2009/06/30/tuning-oracle-for-siebel-sql-template/comment-page-1/#comment-73</link>
		<dc:creator>@lex</dc:creator>
		<pubDate>Thu, 23 Jul 2009 08:28:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.adellera.it/blog/?p=267#comment-73</guid>
		<description>Hi Alberto,

great post and very concise!

However, I just want to throw in that it is a very common practice of the DBA to create &quot;ad hoc&quot; indexes in the Siebel database.

When the Siebel schema is upgraded (say to version 8.1), the upgrade process drops all indexes and recreates only those which are registered in the Siebel Repository (using Siebel Tools).

I strongly encourage that the people creating ad-hoc indexes talk to the Siebel developers so that they can add the index definition to the Siebel Repository. Or even create the definition first and then use the Siebel ddlsync utility to &quot;apply&quot; the metadata-resident definitions to the physical schema.

For indexes where this is not possible, you should at least document the index definition (create statement) in a way that it is present during the upgrade process.

have a nice day

@lex</description>
		<content:encoded><![CDATA[<p>Hi Alberto,</p>
<p>great post and very concise!</p>
<p>However, I just want to throw in that it is a very common practice of the DBA to create &#8220;ad hoc&#8221; indexes in the Siebel database.</p>
<p>When the Siebel schema is upgraded (say to version 8.1), the upgrade process drops all indexes and recreates only those which are registered in the Siebel Repository (using Siebel Tools).</p>
<p>I strongly encourage that the people creating ad-hoc indexes talk to the Siebel developers so that they can add the index definition to the Siebel Repository. Or even create the definition first and then use the Siebel ddlsync utility to &#8220;apply&#8221; the metadata-resident definitions to the physical schema.</p>
<p>For indexes where this is not possible, you should at least document the index definition (create statement) in a way that it is present during the upgrade process.</p>
<p>have a nice day</p>
<p>@lex</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Blogroll Report 26/06/2009 – 03/07/2006 &#171; Coskan&#8217;s Approach to Oracle</title>
		<link>http://www.adellera.it/blog/2009/06/30/tuning-oracle-for-siebel-sql-template/comment-page-1/#comment-62</link>
		<dc:creator>Blogroll Report 26/06/2009 – 03/07/2006 &#171; Coskan&#8217;s Approach to Oracle</dc:creator>
		<pubDate>Fri, 03 Jul 2009 15:29:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.adellera.it/blog/?p=267#comment-62</guid>
		<description>[...] Alberto Dell’Era -Tuning Oracle for Siebel &#8211; SQL template [...]</description>
		<content:encoded><![CDATA[<p>[...] Alberto Dell’Era -Tuning Oracle for Siebel &#8211; SQL template [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alberto Dell'Era</title>
		<link>http://www.adellera.it/blog/2009/06/30/tuning-oracle-for-siebel-sql-template/comment-page-1/#comment-56</link>
		<dc:creator>Alberto Dell'Era</dc:creator>
		<pubDate>Wed, 01 Jul 2009 11:53:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.adellera.it/blog/?p=267#comment-56</guid>
		<description>@James

The indexes are created manually, following the usual procedures - they are &quot;ad hoc&quot; because they are usually useful for one query only, or a bunch of strongly related queries. But they are just regular indexes, and you must make good use of your indexing skills to define them - this post is just an head start,  as it summarizes the main information about the peculiarities of the Siebel environment.</description>
		<content:encoded><![CDATA[<p>@James</p>
<p>The indexes are created manually, following the usual procedures &#8211; they are &#8220;ad hoc&#8221; because they are usually useful for one query only, or a bunch of strongly related queries. But they are just regular indexes, and you must make good use of your indexing skills to define them &#8211; this post is just an head start,  as it summarizes the main information about the peculiarities of the Siebel environment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James</title>
		<link>http://www.adellera.it/blog/2009/06/30/tuning-oracle-for-siebel-sql-template/comment-page-1/#comment-55</link>
		<dc:creator>James</dc:creator>
		<pubDate>Wed, 01 Jul 2009 11:12:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.adellera.it/blog/?p=267#comment-55</guid>
		<description>Very illuminating, thank you. A question on the solution:

If the indexes are ad hoc, will they be created (and afterwards dropped) for each query? Is this manual or automated? If automated, how?

Or will you create a standard set for your most common queries?

Thanks</description>
		<content:encoded><![CDATA[<p>Very illuminating, thank you. A question on the solution:</p>
<p>If the indexes are ad hoc, will they be created (and afterwards dropped) for each query? Is this manual or automated? If automated, how?</p>
<p>Or will you create a standard set for your most common queries?</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
</channel>
</rss>

