<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Empiricism</title>
	<atom:link href="http://jonathanlewis.wordpress.com/2009/07/26/empiricism/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanlewis.wordpress.com/2009/07/26/empiricism/</link>
	<description>Just another Oracle weblog</description>
	<lastBuildDate>Sat, 18 May 2013 11:04:10 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Dana Day</title>
		<link>http://jonathanlewis.wordpress.com/2009/07/26/empiricism/#comment-47874</link>
		<dc:creator><![CDATA[Dana Day]]></dc:creator>
		<pubDate>Thu, 12 Jul 2012 19:32:02 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1859#comment-47874</guid>
		<description><![CDATA[Thank you for your response. I apologize for inappropriate posting. I&#039;ll pursue in an appropriate forum.]]></description>
		<content:encoded><![CDATA[<p>Thank you for your response. I apologize for inappropriate posting. I&#8217;ll pursue in an appropriate forum.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2009/07/26/empiricism/#comment-47873</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Thu, 12 Jul 2012 19:28:54 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1859#comment-47873</guid>
		<description><![CDATA[Dana,
The first point I need to make is that this is not a forum - if you want help solving problems (and aren&#039;t at the point where you need to hire a consultant) you can try the OTN database forum, or Oracle-L for informal aid.

Having said that:
a) you need to check whether the TX enqueues are mode 4 or mode 6, it could make a big difference to diagnosis. Since you are presumably licensed for the performance pack you could query ASH (v$active_session_history, or the dba_ equivalent) to check in more detail. If the waits are numerous and long-term you could also start a trace on a session for a few minutes to see exactly what it is doing.

b) TX enqueues are generally not related to &quot;hot blocks&quot;, they are about data competition, although there can be some odd index leaf block split effects. If you have any evidence that the problem relates to index blocks being delayed as they split and move about a key RAC-related detail is to check for the sequence CACHE size that you are using for your monotonically increasing value. If the problem relates to RAC and high-value leaf blocks then a large sequence cache size (in the order of 1,000 to 10,000) may be sufficient to resolve the problem.

c) The phrase &lt;i&gt;&quot;Over 90% of AWR report on both nodes show Enq Tx.&quot;&lt;/i&gt; is not very clear. If it means that 90% of your DB Time is spent in Enq TX and it&#039;s on this PK index then why do you think there is &quot;a lot of contention on the table as well&quot;. If you do raise your problem on the OTN database forum, make sure you give some quantitive information, rather than vague indicators - e.g. Load Profile and Top Timed Events from both nodes. You&#039;ll also end up being asked to supply some &quot;Segments by ...&quot; sections as well, probably.

d) The single table hash cluster is very limited in it applicability. It is not appropriate for continuously growing data, only for data of a fixed (or strictly bounded) size. Since you&#039;re talking about &quot;line items&quot; with a sequence based key I suspect you have a data set that is, nominally, growing without a bound.]]></description>
		<content:encoded><![CDATA[<p>Dana,<br />
The first point I need to make is that this is not a forum &#8211; if you want help solving problems (and aren&#8217;t at the point where you need to hire a consultant) you can try the OTN database forum, or Oracle-L for informal aid.</p>
<p>Having said that:<br />
a) you need to check whether the TX enqueues are mode 4 or mode 6, it could make a big difference to diagnosis. Since you are presumably licensed for the performance pack you could query ASH (v$active_session_history, or the dba_ equivalent) to check in more detail. If the waits are numerous and long-term you could also start a trace on a session for a few minutes to see exactly what it is doing.</p>
<p>b) TX enqueues are generally not related to &#8220;hot blocks&#8221;, they are about data competition, although there can be some odd index leaf block split effects. If you have any evidence that the problem relates to index blocks being delayed as they split and move about a key RAC-related detail is to check for the sequence CACHE size that you are using for your monotonically increasing value. If the problem relates to RAC and high-value leaf blocks then a large sequence cache size (in the order of 1,000 to 10,000) may be sufficient to resolve the problem.</p>
<p>c) The phrase <i>&#8220;Over 90% of AWR report on both nodes show Enq Tx.&#8221;</i> is not very clear. If it means that 90% of your DB Time is spent in Enq TX and it&#8217;s on this PK index then why do you think there is &#8220;a lot of contention on the table as well&#8221;. If you do raise your problem on the OTN database forum, make sure you give some quantitive information, rather than vague indicators &#8211; e.g. Load Profile and Top Timed Events from both nodes. You&#8217;ll also end up being asked to supply some &#8220;Segments by &#8230;&#8221; sections as well, probably.</p>
<p>d) The single table hash cluster is very limited in it applicability. It is not appropriate for continuously growing data, only for data of a fixed (or strictly bounded) size. Since you&#8217;re talking about &#8220;line items&#8221; with a sequence based key I suspect you have a data set that is, nominally, growing without a bound.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dana</title>
		<link>http://jonathanlewis.wordpress.com/2009/07/26/empiricism/#comment-47774</link>
		<dc:creator><![CDATA[Dana]]></dc:creator>
		<pubDate>Sun, 08 Jul 2012 09:37:55 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1859#comment-47774</guid>
		<description><![CDATA[Jonathan, 

I have a current issue with large waits Enq Tx-row lock contention in a RAC system. The primary wait &quot;appears&quot; to be on a table of line items, about 85 columns of non-pk with a two column pk, both number. The application code seems to do an insert of the two columns of the primary key. Then it does another (or two or three based on dba_tab_modifications) updates of all 85 non-pk columns. Over 90% of AWR report on both nodes show Enq Tx. The line item table also has eight indexes, and 20 columns in the table go to fk&#039;s in small(er) code tables.

My initial thought would be to reduce hot blocks. The primary key is, by the way, a monotonically increasing id, plus a few line numbers, usually less than 10. I am assuming that the primary key is introducing the hot blocks, and using either a id with instance_id/sessionid/sequence_no, or a hash clustered primary key would reduce some of the contention. 

In this case, I believe there is a lot of contention on the table itself. This leads me to look at single table hash clustered design as a potential resolution. 
My problem is in properly designing the cluster hashkeys and size parameters if needed. I am not sure if I size based on avg. row size / block size, or by total number estimated rows ever stored in the table. 

The multiple total-row update pattern is alarming to me, but I am stuck with it for the moment. 
My current SQL is :
[sourcecode]
create cluster quote_line_cluster 
( quote_id         number,
  quote_line_no    number
)
single table
hashkeys 1000;
CREATE TABLE &quot;QUOTE_LINE_CL&quot;
  (
    &quot;QUOTE_ID&quot;                       NUMBER NOT NULL ENABLE,
    &quot;QUOTE_LINE_NO&quot;                  NUMBER NOT NULL ENABLE,....
/*snipped column definitions--about 85*/
)
CLUSTER quote_line_cluster ( quote_id,quote_line_no );

And for the sequence:

create sequence rac_seq start with 1 cache 10000
/
create or replace package rac_seq_pkg
is 
function get_seq return number;
end;
/
create or replace package body rac_seq_pkg
is
function get_seq return number
is
l_id number;
begin
select to_number(TO_CHAR(USERENV(&#039;INSTANCE&#039;))&#124;&#124;TO_CHAR(USERENV(&#039;SESSIONID&#039;))&#124;&#124;to_char(rac_seq.nextval)) into l_id from dual;
return l_id;
end get_seq;
end;
/
[/sourcecode]
I think the sequence will help resolve the initial primary key insert hot spots. But will a hash cluster potentially resolve the table hot spots, or am I off track in pursuing this approach?

Any advice would be appreciated. 

Thanks, 

Dana]]></description>
		<content:encoded><![CDATA[<p>Jonathan, </p>
<p>I have a current issue with large waits Enq Tx-row lock contention in a RAC system. The primary wait &#8220;appears&#8221; to be on a table of line items, about 85 columns of non-pk with a two column pk, both number. The application code seems to do an insert of the two columns of the primary key. Then it does another (or two or three based on dba_tab_modifications) updates of all 85 non-pk columns. Over 90% of AWR report on both nodes show Enq Tx. The line item table also has eight indexes, and 20 columns in the table go to fk&#8217;s in small(er) code tables.</p>
<p>My initial thought would be to reduce hot blocks. The primary key is, by the way, a monotonically increasing id, plus a few line numbers, usually less than 10. I am assuming that the primary key is introducing the hot blocks, and using either a id with instance_id/sessionid/sequence_no, or a hash clustered primary key would reduce some of the contention. </p>
<p>In this case, I believe there is a lot of contention on the table itself. This leads me to look at single table hash clustered design as a potential resolution.<br />
My problem is in properly designing the cluster hashkeys and size parameters if needed. I am not sure if I size based on avg. row size / block size, or by total number estimated rows ever stored in the table. </p>
<p>The multiple total-row update pattern is alarming to me, but I am stuck with it for the moment.<br />
My current SQL is :</p>
<pre class="brush: plain; title: ; notranslate">
create cluster quote_line_cluster 
( quote_id         number,
  quote_line_no    number
)
single table
hashkeys 1000;
CREATE TABLE &quot;QUOTE_LINE_CL&quot;
  (
    &quot;QUOTE_ID&quot;                       NUMBER NOT NULL ENABLE,
    &quot;QUOTE_LINE_NO&quot;                  NUMBER NOT NULL ENABLE,....
/*snipped column definitions--about 85*/
)
CLUSTER quote_line_cluster ( quote_id,quote_line_no );

And for the sequence:

create sequence rac_seq start with 1 cache 10000
/
create or replace package rac_seq_pkg
is 
function get_seq return number;
end;
/
create or replace package body rac_seq_pkg
is
function get_seq return number
is
l_id number;
begin
select to_number(TO_CHAR(USERENV('INSTANCE'))||TO_CHAR(USERENV('SESSIONID'))||to_char(rac_seq.nextval)) into l_id from dual;
return l_id;
end get_seq;
end;
/
</pre>
<p>I think the sequence will help resolve the initial primary key insert hot spots. But will a hash cluster potentially resolve the table hot spots, or am I off track in pursuing this approach?</p>
<p>Any advice would be appreciated. </p>
<p>Thanks, </p>
<p>Dana</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2009/07/26/empiricism/#comment-34101</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Mon, 10 Aug 2009 21:48:46 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1859#comment-34101</guid>
		<description><![CDATA[Tanel,

I didn&#039;t phrase my comment very well - the &quot;waiter that couldn&#039;t get back&quot; was probably waiting in the common queue for a server to become available, not &quot;on a server waiting and then quitting&quot; (although the client did have some &#039;select for update ... skipped locked&#039; statements - which have some very funny side effects on enqueue behaviour.

If I recall corrrectly the wait times were in the order of a very small number of seconds. Trying to solve the exact cause of the problem is a non-issue since it went away when the system was configured properly - and since the suggested change had the predicted (as in &lt;em&gt;&quot;and this might be the cause of your locking problem&quot;&lt;/em&gt;) result I never got past the &quot;hand-waving&quot; explanation of why it was an appropriate solution and on to look at the exact mechanism.
]]></description>
		<content:encoded><![CDATA[<p>Tanel,</p>
<p>I didn&#8217;t phrase my comment very well &#8211; the &#8220;waiter that couldn&#8217;t get back&#8221; was probably waiting in the common queue for a server to become available, not &#8220;on a server waiting and then quitting&#8221; (although the client did have some &#8216;select for update &#8230; skipped locked&#8217; statements &#8211; which have some very funny side effects on enqueue behaviour.</p>
<p>If I recall corrrectly the wait times were in the order of a very small number of seconds. Trying to solve the exact cause of the problem is a non-issue since it went away when the system was configured properly &#8211; and since the suggested change had the predicted (as in <em>&#8220;and this might be the cause of your locking problem&#8221;</em>) result I never got past the &#8220;hand-waving&#8221; explanation of why it was an appropriate solution and on to look at the exact mechanism.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tanel Poder</title>
		<link>http://jonathanlewis.wordpress.com/2009/07/26/empiricism/#comment-34100</link>
		<dc:creator><![CDATA[Tanel Poder]]></dc:creator>
		<pubDate>Mon, 10 Aug 2009 15:24:02 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1859#comment-34100</guid>
		<description><![CDATA[Hi Jonathan,

Oracle releases a shared server process back to other sessions only when the database call has finished. Even if a session is hung waiting for a lock (or sleeping due dbms_lock.sleep, waiting for IO, etc), the same server process will be exclusively associated with a single session.

This rules out issues like &quot;not being able to get a process to complete the database call&quot; as a process is always associated with the session during a call.

If it had been a real hang (circular wait chain) then deadlock detection would have rolled someone&#039;s call back.. but if you didn&#039;t see those it&#039;s probably just that a lot of sessions ended up waiting (indirectly) for the same blocker and this issue may have been amplified with other symptoms like CPU starvation due many shared server process startups. 

And that leads to the question, how long stalls did you see? Was it seconds instead of milliseconds or minutes instead of seconds or more?

Or as you said it could have been some loadrunner load profile timing issue..]]></description>
		<content:encoded><![CDATA[<p>Hi Jonathan,</p>
<p>Oracle releases a shared server process back to other sessions only when the database call has finished. Even if a session is hung waiting for a lock (or sleeping due dbms_lock.sleep, waiting for IO, etc), the same server process will be exclusively associated with a single session.</p>
<p>This rules out issues like &#8220;not being able to get a process to complete the database call&#8221; as a process is always associated with the session during a call.</p>
<p>If it had been a real hang (circular wait chain) then deadlock detection would have rolled someone&#8217;s call back.. but if you didn&#8217;t see those it&#8217;s probably just that a lot of sessions ended up waiting (indirectly) for the same blocker and this issue may have been amplified with other symptoms like CPU starvation due many shared server process startups. </p>
<p>And that leads to the question, how long stalls did you see? Was it seconds instead of milliseconds or minutes instead of seconds or more?</p>
<p>Or as you said it could have been some loadrunner load profile timing issue..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2009/07/26/empiricism/#comment-34060</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Thu, 06 Aug 2009 16:33:57 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1859#comment-34060</guid>
		<description><![CDATA[Gary,

There&#039;s no &quot;select for update&quot;. The only statements in the library cache are:

insert into tabX
update tabX where pk = 
delete from tabX where pk =


I think the underyling problem is one of confusion in the connection pooling mechanism - and the apparent resolution from change the number of shared servers is simply a timing benefit.

One point I haven&#039;t mentioned, by the way, is that the thing is a benchmark type of thing being controlled by LoadRunner. It&#039;s quite possible that there&#039;s a flaw in the driving data, or in the way LoadRunner has been configured, that allows &quot;business transactions&quot; to interfere with each other.]]></description>
		<content:encoded><![CDATA[<p>Gary,</p>
<p>There&#8217;s no &#8220;select for update&#8221;. The only statements in the library cache are:</p>
<p>insert into tabX<br />
update tabX where pk =<br />
delete from tabX where pk =</p>
<p>I think the underyling problem is one of confusion in the connection pooling mechanism &#8211; and the apparent resolution from change the number of shared servers is simply a timing benefit.</p>
<p>One point I haven&#8217;t mentioned, by the way, is that the thing is a benchmark type of thing being controlled by LoadRunner. It&#8217;s quite possible that there&#8217;s a flaw in the driving data, or in the way LoadRunner has been configured, that allows &#8220;business transactions&#8221; to interfere with each other.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2009/07/26/empiricism/#comment-34056</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Thu, 06 Aug 2009 16:07:31 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1859#comment-34056</guid>
		<description><![CDATA[Amit,

Your enqueue wait is for a TX lock in mode 6 - which should be a simple data collision on a heap table.

Your users are queueuing because they want to update (delete) the same rows (or row) in the table.

It looks like you need to find a way to stop doing this, or find a way of commiting the change as quickly as possible.]]></description>
		<content:encoded><![CDATA[<p>Amit,</p>
<p>Your enqueue wait is for a TX lock in mode 6 &#8211; which should be a simple data collision on a heap table.</p>
<p>Your users are queueuing because they want to update (delete) the same rows (or row) in the table.</p>
<p>It looks like you need to find a way to stop doing this, or find a way of commiting the change as quickly as possible.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lascoltodelvenerdi</title>
		<link>http://jonathanlewis.wordpress.com/2009/07/26/empiricism/#comment-34050</link>
		<dc:creator><![CDATA[lascoltodelvenerdi]]></dc:creator>
		<pubDate>Thu, 06 Aug 2009 14:20:58 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1859#comment-34050</guid>
		<description><![CDATA[If I understand you have 550 session all doing something like:

DELETE FROM APP_USER_FUNCTION WHERE DOMAIN_ID = 1000000 AND USER_ID = 9999999

then in this case, I think, increasing the value of the initrans would not help you.
When a session have to delete a row, it place a lock on it and the other(s) session(s) must wait until a commit or rollback.

Initrans can help you if you have a lot of insert.

To tune this...mumble...I would place a commit after the delete IF AND ONLY IF this don&#039;t change the flow of the program.

I found a bit strange that 550 concurrent session issue the same delete.]]></description>
		<content:encoded><![CDATA[<p>If I understand you have 550 session all doing something like:</p>
<p>DELETE FROM APP_USER_FUNCTION WHERE DOMAIN_ID = 1000000 AND USER_ID = 9999999</p>
<p>then in this case, I think, increasing the value of the initrans would not help you.<br />
When a session have to delete a row, it place a lock on it and the other(s) session(s) must wait until a commit or rollback.</p>
<p>Initrans can help you if you have a lot of insert.</p>
<p>To tune this&#8230;mumble&#8230;I would place a commit after the delete IF AND ONLY IF this don&#8217;t change the flow of the program.</p>
<p>I found a bit strange that 550 concurrent session issue the same delete.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amit Bhube</title>
		<link>http://jonathanlewis.wordpress.com/2009/07/26/empiricism/#comment-34049</link>
		<dc:creator><![CDATA[Amit Bhube]]></dc:creator>
		<pubDate>Thu, 06 Aug 2009 12:01:44 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1859#comment-34049</guid>
		<description><![CDATA[Hi Jonathan 

I am facing a similar problem at a client site .
There are around 500 Sessions waiting for enq: TX - row lock contention .

The SQL being fired is DELETE FROM APP_USER_FUNCTION WHERE DOMAIN_ID = :B2 AND USER_ID = :B1 from 550 different  sessions .

Following were my observations 

SID EVENT                                  P1         P2 SECONDS_IN_WAIT STATE
---- ------------------------------ ---------- ---------- --------------- ----------
1016 enq: TX - row lock contention  1415053318    1835049               0 WAITING
1017                                1415053318    1835049               0 WAITING
.

The table in question was APP_USER_FUNCTION .
This table doesnt have a primary key or a foreign key on it.Also index is present on domain_id and user_id column (Con-catinated index) .

Can you tell me by increasing the inittrans value of this table from 1 to say 10 helpme in any ways !! 

Or any other way to tune this type of contention !!

Regards

Amit bhube]]></description>
		<content:encoded><![CDATA[<p>Hi Jonathan </p>
<p>I am facing a similar problem at a client site .<br />
There are around 500 Sessions waiting for enq: TX &#8211; row lock contention .</p>
<p>The SQL being fired is DELETE FROM APP_USER_FUNCTION WHERE DOMAIN_ID = :B2 AND USER_ID = :B1 from 550 different  sessions .</p>
<p>Following were my observations </p>
<p>SID EVENT                                  P1         P2 SECONDS_IN_WAIT STATE<br />
&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;-<br />
1016 enq: TX &#8211; row lock contention  1415053318    1835049               0 WAITING<br />
1017                                1415053318    1835049               0 WAITING<br />
.</p>
<p>The table in question was APP_USER_FUNCTION .<br />
This table doesnt have a primary key or a foreign key on it.Also index is present on domain_id and user_id column (Con-catinated index) .</p>
<p>Can you tell me by increasing the inittrans value of this table from 1 to say 10 helpme in any ways !! </p>
<p>Or any other way to tune this type of contention !!</p>
<p>Regards</p>
<p>Amit bhube</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gary</title>
		<link>http://jonathanlewis.wordpress.com/2009/07/26/empiricism/#comment-34030</link>
		<dc:creator><![CDATA[Gary]]></dc:creator>
		<pubDate>Mon, 03 Aug 2009 23:04:24 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=1859#comment-34030</guid>
		<description><![CDATA[That front-end code doesn&#039;t do a SELECT..FOR UPDATE does it ? Wouldn&#039;t fire any triggers, but if the connection pool gets confused the app may have issued a SELECT...FOR UPDATE in one transaction and then tried to update the locked row in a separate transaction. Either the first transaction eventually gets rolled-back by some cleanup, or the confusion means it gets committed as part of another transaction.]]></description>
		<content:encoded><![CDATA[<p>That front-end code doesn&#8217;t do a SELECT..FOR UPDATE does it ? Wouldn&#8217;t fire any triggers, but if the connection pool gets confused the app may have issued a SELECT&#8230;FOR UPDATE in one transaction and then tried to update the locked row in a separate transaction. Either the first transaction eventually gets rolled-back by some cleanup, or the confusion means it gets committed as part of another transaction.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
