<?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: Short Sorts</title>
	<atom:link href="http://jonathanlewis.wordpress.com/2009/12/28/short-sorts/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanlewis.wordpress.com/2009/12/28/short-sorts/</link>
	<description>Just another Oracle weblog</description>
	<lastBuildDate>Mon, 20 May 2013 17:10:14 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Count(*) &#171; Oracle Scratchpad</title>
		<link>http://jonathanlewis.wordpress.com/2009/12/28/short-sorts/#comment-45325</link>
		<dc:creator><![CDATA[Count(*) &#171; Oracle Scratchpad]]></dc:creator>
		<pubDate>Tue, 06 Mar 2012 16:58:42 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2739#comment-45325</guid>
		<description><![CDATA[[...] for a sort aggregate operation can be very small compared to the volume of data processed. (See this note for an example of how Oracle can handle one type of special case involving [...]]]></description>
		<content:encoded><![CDATA[<p>[...] for a sort aggregate operation can be very small compared to the volume of data processed. (See this note for an example of how Oracle can handle one type of special case involving [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Blogroll Report 25/12/2009 – 01/01/2010 &#171; Coskan&#8217;s Approach to Oracle</title>
		<link>http://jonathanlewis.wordpress.com/2009/12/28/short-sorts/#comment-35194</link>
		<dc:creator><![CDATA[Blogroll Report 25/12/2009 – 01/01/2010 &#171; Coskan&#8217;s Approach to Oracle]]></dc:creator>
		<pubDate>Fri, 08 Jan 2010 18:50:46 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2739#comment-35194</guid>
		<description><![CDATA[[...] 5-How many rows are sorted and how much memory used by your query? Jonathan Lewis-Short Sorts [...]]]></description>
		<content:encoded><![CDATA[<p>[...] 5-How many rows are sorted and how much memory used by your query? Jonathan Lewis-Short Sorts [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lascoltodelvenerdi</title>
		<link>http://jonathanlewis.wordpress.com/2009/12/28/short-sorts/#comment-35151</link>
		<dc:creator><![CDATA[lascoltodelvenerdi]]></dc:creator>
		<pubDate>Sat, 02 Jan 2010 21:55:02 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2739#comment-35151</guid>
		<description><![CDATA[I was stressing the ambiguity...and ended to be ambiguous. Sorry.]]></description>
		<content:encoded><![CDATA[<p>I was stressing the ambiguity&#8230;and ended to be ambiguous. Sorry.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2009/12/28/short-sorts/#comment-35125</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Wed, 30 Dec 2009 16:47:22 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2739#comment-35125</guid>
		<description><![CDATA[Bernard,

I wouldn&#039;t have used the expression &quot;clustering factor&quot; in this context (data can be well clustered without being well-ordered) but you are essentially correct. 

For this type of &quot;short sort&quot;, the work done and the memory used do depend on the arrival order of the data. 

(Footnote: My memory from the days when I did computer science is that every sort algorithm was subject to some boundary cases where the data order was &quot;bad for&quot; the algorithm - basically the order of input always affected the amount of work needed and the worst case was always very bad.)]]></description>
		<content:encoded><![CDATA[<p>Bernard,</p>
<p>I wouldn&#8217;t have used the expression &#8220;clustering factor&#8221; in this context (data can be well clustered without being well-ordered) but you are essentially correct. </p>
<p>For this type of &#8220;short sort&#8221;, the work done and the memory used do depend on the arrival order of the data. </p>
<p>(Footnote: My memory from the days when I did computer science is that every sort algorithm was subject to some boundary cases where the data order was &#8220;bad for&#8221; the algorithm &#8211; basically the order of input always affected the amount of work needed and the worst case was always very bad.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2009/12/28/short-sorts/#comment-35124</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Wed, 30 Dec 2009 16:35:21 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2739#comment-35124</guid>
		<description><![CDATA[Antonio,

I&#039;ve re-read the posting and don&#039;t see any confusion between sorting and comparing. What I see is that we can infer from the change in the number of comparisons that something different has happened during sorting.

One of your commnet, however, highlights the ambiguity that surrounds the word &quot;sorting&quot; in this context.

When as ask for 10 rows, the mechanism does not &quot;sort&quot; 1,000,000 rows because it does NOT get 1,000,000 rows into order; it gets 10 rows into order, and 999,990 rows which are not well-ordered.]]></description>
		<content:encoded><![CDATA[<p>Antonio,</p>
<p>I&#8217;ve re-read the posting and don&#8217;t see any confusion between sorting and comparing. What I see is that we can infer from the change in the number of comparisons that something different has happened during sorting.</p>
<p>One of your commnet, however, highlights the ambiguity that surrounds the word &#8220;sorting&#8221; in this context.</p>
<p>When as ask for 10 rows, the mechanism does not &#8220;sort&#8221; 1,000,000 rows because it does NOT get 1,000,000 rows into order; it gets 10 rows into order, and 999,990 rows which are not well-ordered.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2009/12/28/short-sorts/#comment-35123</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Wed, 30 Dec 2009 16:27:21 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2739#comment-35123</guid>
		<description><![CDATA[Narenda,

No smoke, at least not intentionally. If you think about the two comments I made about the data, one of them tells you what it &lt;em&gt;&lt;strong&gt;looks like&lt;/strong&gt;&lt;/em&gt;, the other tells you what it is supposed to &lt;em&gt;&lt;strong&gt;represent&lt;/strong&gt;&lt;/em&gt;.]]></description>
		<content:encoded><![CDATA[<p>Narenda,</p>
<p>No smoke, at least not intentionally. If you think about the two comments I made about the data, one of them tells you what it <em><strong>looks like</strong></em>, the other tells you what it is supposed to <em><strong>represent</strong></em>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bernard Polarski</title>
		<link>http://jonathanlewis.wordpress.com/2009/12/28/short-sorts/#comment-35120</link>
		<dc:creator><![CDATA[Bernard Polarski]]></dc:creator>
		<pubDate>Wed, 30 Dec 2009 08:32:19 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2739#comment-35120</guid>
		<description><![CDATA[Shall we understand that, given the nature of the 10gr2 binary tree sorting, it is not possible to respond in advance to the Quiz unless an exact measure of the disorganization of the table is also provided for sorting load is now related to clustering factor.]]></description>
		<content:encoded><![CDATA[<p>Shall we understand that, given the nature of the 10gr2 binary tree sorting, it is not possible to respond in advance to the Quiz unless an exact measure of the disorganization of the table is also provided for sorting load is now related to clustering factor.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lascoltodelvenerdi</title>
		<link>http://jonathanlewis.wordpress.com/2009/12/28/short-sorts/#comment-35119</link>
		<dc:creator><![CDATA[lascoltodelvenerdi]]></dc:creator>
		<pubDate>Wed, 30 Dec 2009 07:58:04 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2739#comment-35119</guid>
		<description><![CDATA[I don&#039;t think your original question “How many rows does Oracle sort?” was unfair and ambiguous.

But I think that here you are mixing up a bit of ideas.

The first is the number of rows that there is in the table. It&#039;s 1.000.000 full stop. So Oracle sort 1.000.000 rows, i.e. Oracle reads 1.000.000 rows and &quot;do-some-magic&quot; so we get them ordered.

The second idea is how many comparisons Oracle does to sort that rows. &quot;Comparisons&quot; are a complete different kind of objects and they depends on the algorithm that is used to sort (i.e. qsort is better that bubble sort because it does less comparisons).

Reading your post, I get the idea that you mean &quot;Oracle have 1.000.000 rows but it sorts 2.000.000 rows&quot; (as it multiplies it), well this is wrong, at least &quot;we can say that Oracle do 3.000.000 comparisons to sort 1.000.000&quot; but the number of rows doesn&#039;t change.

Bye,
Antonio]]></description>
		<content:encoded><![CDATA[<p>I don&#8217;t think your original question “How many rows does Oracle sort?” was unfair and ambiguous.</p>
<p>But I think that here you are mixing up a bit of ideas.</p>
<p>The first is the number of rows that there is in the table. It&#8217;s 1.000.000 full stop. So Oracle sort 1.000.000 rows, i.e. Oracle reads 1.000.000 rows and &#8220;do-some-magic&#8221; so we get them ordered.</p>
<p>The second idea is how many comparisons Oracle does to sort that rows. &#8220;Comparisons&#8221; are a complete different kind of objects and they depends on the algorithm that is used to sort (i.e. qsort is better that bubble sort because it does less comparisons).</p>
<p>Reading your post, I get the idea that you mean &#8220;Oracle have 1.000.000 rows but it sorts 2.000.000 rows&#8221; (as it multiplies it), well this is wrong, at least &#8220;we can say that Oracle do 3.000.000 comparisons to sort 1.000.000&#8243; but the number of rows doesn&#8217;t change.</p>
<p>Bye,<br />
Antonio</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Winston</title>
		<link>http://jonathanlewis.wordpress.com/2009/12/28/short-sorts/#comment-35113</link>
		<dc:creator><![CDATA[Winston]]></dc:creator>
		<pubDate>Tue, 29 Dec 2009 00:02:14 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2739#comment-35113</guid>
		<description><![CDATA[I ran it on 11.2.0.1.0

ordered
---- Sort Statistics ------------------------------
Input records                             1048576
Output records                            10
Total number of comparisons performed     1048575
  Comparisons performed by in-memory sort 1048575
Total amount of memory used               2048
Uses version 1 sort


reversed
---- Sort Statistics ------------------------------
Input records                             1048576
Output records                            1048576
Total number of comparisons performed     5242856
  Comparisons performed by in-memory sort 5242856
Total amount of memory used               1337344
Uses version 1 sort

randomised
---- Sort Statistics ------------------------------
Input records                             1048576
Output records                            135
Total number of comparisons performed     1049022
  Comparisons performed by in-memory sort 1049022
Total amount of memory used               2048
Uses version 1 sort

All of them are using Version 1 sort. How can I force Oracle to use Version 2 sort?
and how can I force it to use version 1 sort?]]></description>
		<content:encoded><![CDATA[<p>I ran it on 11.2.0.1.0</p>
<p>ordered<br />
&#8212;- Sort Statistics &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Input records                             1048576<br />
Output records                            10<br />
Total number of comparisons performed     1048575<br />
  Comparisons performed by in-memory sort 1048575<br />
Total amount of memory used               2048<br />
Uses version 1 sort</p>
<p>reversed<br />
&#8212;- Sort Statistics &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Input records                             1048576<br />
Output records                            1048576<br />
Total number of comparisons performed     5242856<br />
  Comparisons performed by in-memory sort 5242856<br />
Total amount of memory used               1337344<br />
Uses version 1 sort</p>
<p>randomised<br />
&#8212;- Sort Statistics &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Input records                             1048576<br />
Output records                            135<br />
Total number of comparisons performed     1049022<br />
  Comparisons performed by in-memory sort 1049022<br />
Total amount of memory used               2048<br />
Uses version 1 sort</p>
<p>All of them are using Version 1 sort. How can I force Oracle to use Version 2 sort?<br />
and how can I force it to use version 1 sort?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Narendra</title>
		<link>http://jonathanlewis.wordpress.com/2009/12/28/short-sorts/#comment-35112</link>
		<dc:creator><![CDATA[Narendra]]></dc:creator>
		<pubDate>Mon, 28 Dec 2009 22:51:18 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=2739#comment-35112</guid>
		<description><![CDATA[Hmm...
So the statement &lt;i&gt;The table has a column called sortcode which has no nulls, and has been generated in a highly random way so that no value appears more than four times &lt;/i&gt; was just a smoke ?
But thanks. I was not even aware of 10032 event and reading other comments made me realise what other possibilities I did not even think of.]]></description>
		<content:encoded><![CDATA[<p>Hmm&#8230;<br />
So the statement <i>The table has a column called sortcode which has no nulls, and has been generated in a highly random way so that no value appears more than four times </i> was just a smoke ?<br />
But thanks. I was not even aware of 10032 event and reading other comments made me realise what other possibilities I did not even think of.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
