<?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: Slow Code</title>
	<atom:link href="http://jonathanlewis.wordpress.com/2007/05/15/slow-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanlewis.wordpress.com/2007/05/15/slow-code/</link>
	<description>Just another Oracle weblog</description>
	<lastBuildDate>Fri, 24 May 2013 13:27:07 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Event snapshots &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2007/05/15/slow-code/#comment-31295</link>
		<dc:creator><![CDATA[Event snapshots &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Sun, 15 Jun 2008 20:13:38 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/05/15/slow-code/#comment-31295</guid>
		<description><![CDATA[[...] &#8212; Jonathan Lewis @ 8:13 pm UTC Jun 15,2008   Some time ago I wrote a note about using dbms_lock() to slow down your SQL, and followed up with an example of using this type of code to help with [...]]]></description>
		<content:encoded><![CDATA[<p>[...] &#8212; Jonathan Lewis @ 8:13 pm UTC Jun 15,2008   Some time ago I wrote a note about using dbms_lock() to slow down your SQL, and followed up with an example of using this type of code to help with [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2007/05/15/slow-code/#comment-8844</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Fri, 18 May 2007 09:54:31 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/05/15/slow-code/#comment-8844</guid>
		<description><![CDATA[Gabe, Alexander: My error. If you want to use a pl/sql function to build a &lt;i&gt;&#039;function-based index&#039;&lt;/i&gt; it has to be deterministic. This has got me into the habit of declaring &lt;b&gt;any&lt;/b&gt; function I call from SQL a deterministic function, even though it&#039;s not necessary.]]></description>
		<content:encoded><![CDATA[<p>Gabe, Alexander: My error. If you want to use a pl/sql function to build a <i>&#8216;function-based index&#8217;</i> it has to be deterministic. This has got me into the habit of declaring <b>any</b> function I call from SQL a deterministic function, even though it&#8217;s not necessary.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: matthew</title>
		<link>http://jonathanlewis.wordpress.com/2007/05/15/slow-code/#comment-8819</link>
		<dc:creator><![CDATA[matthew]]></dc:creator>
		<pubDate>Fri, 18 May 2007 07:06:38 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/05/15/slow-code/#comment-8819</guid>
		<description><![CDATA[gabe

thank you, I just didn&#039;t get it at first]]></description>
		<content:encoded><![CDATA[<p>gabe</p>
<p>thank you, I just didn&#8217;t get it at first</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gabe</title>
		<link>http://jonathanlewis.wordpress.com/2007/05/15/slow-code/#comment-8748</link>
		<dc:creator><![CDATA[Gabe]]></dc:creator>
		<pubDate>Thu, 17 May 2007 18:03:03 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/05/15/slow-code/#comment-8748</guid>
		<description><![CDATA[Alexander,

Quite true.
I just kept &quot;building on&quot; ... taking the deterministic clause out is indeed all it takes to avoid the caching.

Thanks.]]></description>
		<content:encoded><![CDATA[<p>Alexander,</p>
<p>Quite true.<br />
I just kept &#8220;building on&#8221; &#8230; taking the deterministic clause out is indeed all it takes to avoid the caching.</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexander Fatkulin</title>
		<link>http://jonathanlewis.wordpress.com/2007/05/15/slow-code/#comment-8636</link>
		<dc:creator><![CDATA[Alexander Fatkulin]]></dc:creator>
		<pubDate>Wed, 16 May 2007 23:46:06 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/05/15/slow-code/#comment-8636</guid>
		<description><![CDATA[Gabe,

for your case - why not just get rid of the deterministic clause?

That way you don&#039;t need to play with a rownum&#039;s and such.]]></description>
		<content:encoded><![CDATA[<p>Gabe,</p>
<p>for your case &#8211; why not just get rid of the deterministic clause?</p>
<p>That way you don&#8217;t need to play with a rownum&#8217;s and such.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gabe</title>
		<link>http://jonathanlewis.wordpress.com/2007/05/15/slow-code/#comment-8611</link>
		<dc:creator><![CDATA[Gabe]]></dc:creator>
		<pubDate>Wed, 16 May 2007 16:24:41 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/05/15/slow-code/#comment-8611</guid>
		<description><![CDATA[Matthew,

Well, you’re not switching off anything really. You just make it so there is nothing to cache: the cache is based on the input … add something unique, like rownum, and then you’re sleeping on every row. The function remains deterministic.

create or replace function wait_row(
	i_v	in	varchar2,
	i_sec	in	number default 5,
        i_rnm   in      number default 0
) return varchar2
deterministic
parallel_enable
as
begin
	sys.dbms_lock.sleep(i_sec);
	return i_v;
end;
/

SQL&gt; select wait_row(n,1) from x;

WAIT_ROW(N,1)
------------------------------------------------

0001
0000
0001
0000
0001
0000
0001
0000
0001
0000
0001

11 rows selected.

Elapsed: 00:00:03.01
SQL&gt; select wait_row(n,1,rownum) from x;

WAIT_ROW(N,1,ROWNUM)
------------------------------------------------

0001
0000
0001
0000
0001
0000
0001
0000
0001
0000
0001

11 rows selected.

Elapsed: 00:00:11.03

Caveats?]]></description>
		<content:encoded><![CDATA[<p>Matthew,</p>
<p>Well, you’re not switching off anything really. You just make it so there is nothing to cache: the cache is based on the input … add something unique, like rownum, and then you’re sleeping on every row. The function remains deterministic.</p>
<p>create or replace function wait_row(<br />
	i_v	in	varchar2,<br />
	i_sec	in	number default 5,<br />
        i_rnm   in      number default 0<br />
) return varchar2<br />
deterministic<br />
parallel_enable<br />
as<br />
begin<br />
	sys.dbms_lock.sleep(i_sec);<br />
	return i_v;<br />
end;<br />
/</p>
<p>SQL&gt; select wait_row(n,1) from x;</p>
<p>WAIT_ROW(N,1)<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>0001<br />
0000<br />
0001<br />
0000<br />
0001<br />
0000<br />
0001<br />
0000<br />
0001<br />
0000<br />
0001</p>
<p>11 rows selected.</p>
<p>Elapsed: 00:00:03.01<br />
SQL&gt; select wait_row(n,1,rownum) from x;</p>
<p>WAIT_ROW(N,1,ROWNUM)<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>0001<br />
0000<br />
0001<br />
0000<br />
0001<br />
0000<br />
0001<br />
0000<br />
0001<br />
0000<br />
0001</p>
<p>11 rows selected.</p>
<p>Elapsed: 00:00:11.03</p>
<p>Caveats?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: v$session_wait_history &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2007/05/15/slow-code/#comment-8585</link>
		<dc:creator><![CDATA[v$session_wait_history &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Wed, 16 May 2007 10:14:21 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/05/15/slow-code/#comment-8585</guid>
		<description><![CDATA[[...] of the first things I did with the wait_row() function that I described in my last blog, was to set up a simple way to emulate this view in 8i and 9i. The code, which has to be run under [...]]]></description>
		<content:encoded><![CDATA[<p>[...] of the first things I did with the wait_row() function that I described in my last blog, was to set up a simple way to emulate this view in 8i and 9i. The code, which has to be run under [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: matthew</title>
		<link>http://jonathanlewis.wordpress.com/2007/05/15/slow-code/#comment-8574</link>
		<dc:creator><![CDATA[matthew]]></dc:creator>
		<pubDate>Wed, 16 May 2007 08:30:33 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/05/15/slow-code/#comment-8574</guid>
		<description><![CDATA[gabe, 

I can&#039;t follow you
Could you please explain ?

Sounds very interesting, can I really switch the caching mechanism on / off ?]]></description>
		<content:encoded><![CDATA[<p>gabe, </p>
<p>I can&#8217;t follow you<br />
Could you please explain ?</p>
<p>Sounds very interesting, can I really switch the caching mechanism on / off ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: neil kodner</title>
		<link>http://jonathanlewis.wordpress.com/2007/05/15/slow-code/#comment-8469</link>
		<dc:creator><![CDATA[neil kodner]]></dc:creator>
		<pubDate>Tue, 15 May 2007 17:39:13 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/05/15/slow-code/#comment-8469</guid>
		<description><![CDATA[Every time I&#039;ve tried to use dbms_lock.sleep(), I&#039;ve run into weird latching problems.  This was in the 9.2.0.4. days.  I remember that a lot of other things would slow down when I invoked sleep().  Maybe things are different now-would you be willing to run some tests?]]></description>
		<content:encoded><![CDATA[<p>Every time I&#8217;ve tried to use dbms_lock.sleep(), I&#8217;ve run into weird latching problems.  This was in the 9.2.0.4. days.  I remember that a lot of other things would slow down when I invoked sleep().  Maybe things are different now-would you be willing to run some tests?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gabe</title>
		<link>http://jonathanlewis.wordpress.com/2007/05/15/slow-code/#comment-8465</link>
		<dc:creator><![CDATA[Gabe]]></dc:creator>
		<pubDate>Tue, 15 May 2007 15:36:53 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/05/15/slow-code/#comment-8465</guid>
		<description><![CDATA[A third parameter defaulted to 0 would allow to – effectively - bypass or allow the caching mechanism by passing or not passing in the rownum. Would it not?]]></description>
		<content:encoded><![CDATA[<p>A third parameter defaulted to 0 would allow to – effectively &#8211; bypass or allow the caching mechanism by passing or not passing in the rownum. Would it not?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
