<?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"
	>
<channel>
	<title>Comments on: HASH GROUP BY can give wrong result in Oracle 10.2</title>
	<atom:link href="http://www.oracloid.com/2006/05/hash-group-by-can-give-wrong-result-in-oracle-102/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.oracloid.com/2006/05/hash-group-by-can-give-wrong-result-in-oracle-102/</link>
	<description>The Alex Gorbachev Oracle Blog</description>
	<pubDate>Wed, 07 Jan 2009 04:26:25 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Alex Gorbachev</title>
		<link>http://www.oracloid.com/2006/05/hash-group-by-can-give-wrong-result-in-oracle-102/#comment-20199</link>
		<dc:creator>Alex Gorbachev</dc:creator>
		<pubDate>Fri, 12 Sep 2008 03:19:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.oracloid.com/?p=6#comment-20199</guid>
		<description>Yeah... good examples of the cases when involving someone who have already done it *many* times pays off.</description>
		<content:encoded><![CDATA[<p>Yeah&#8230; good examples of the cases when involving someone who have already done it *many* times pays off.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sudhir Kaul</title>
		<link>http://www.oracloid.com/2006/05/hash-group-by-can-give-wrong-result-in-oracle-102/#comment-20198</link>
		<dc:creator>Sudhir Kaul</dc:creator>
		<pubDate>Fri, 12 Sep 2008 02:44:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.oracloid.com/?p=6#comment-20198</guid>
		<description>I encountered the same bug in my project when migrating from 9i to 10g.
After a lot of efforts I could make out that this is a bug in Oracle.</description>
		<content:encoded><![CDATA[<p>I encountered the same bug in my project when migrating from 9i to 10g.<br />
After a lot of efforts I could make out that this is a bug in Oracle.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Saurabh Dhawan</title>
		<link>http://www.oracloid.com/2006/05/hash-group-by-can-give-wrong-result-in-oracle-102/#comment-20183</link>
		<dc:creator>Saurabh Dhawan</dc:creator>
		<pubDate>Thu, 11 Sep 2008 09:33:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.oracloid.com/?p=6#comment-20183</guid>
		<description>Gosh... I have this exact bug in my production environment... Spent two sleepless nights on debugging this issue..</description>
		<content:encoded><![CDATA[<p>Gosh&#8230; I have this exact bug in my production environment&#8230; Spent two sleepless nights on debugging this issue..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex Fatkulin</title>
		<link>http://www.oracloid.com/2006/05/hash-group-by-can-give-wrong-result-in-oracle-102/#comment-17784</link>
		<dc:creator>Alex Fatkulin</dc:creator>
		<pubDate>Fri, 13 Jun 2008 17:59:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.oracloid.com/?p=6#comment-17784</guid>
		<description>Dinesh,

10GR2 added a new group by algorithm -- hash group by, that's why you have your observation.

That being said, group by was never documented to return rows in a sorted order in any version of Oracle, try execute it in parallel for example (that's it -- altering the default degree for a table will make your code which relies on a group by doing a sort to break because your code was based on a wrong assumption).</description>
		<content:encoded><![CDATA[<p>Dinesh,</p>
<p>10GR2 added a new group by algorithm &#8212; hash group by, that&#8217;s why you have your observation.</p>
<p>That being said, group by was never documented to return rows in a sorted order in any version of Oracle, try execute it in parallel for example (that&#8217;s it &#8212; altering the default degree for a table will make your code which relies on a group by doing a sort to break because your code was based on a wrong assumption).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dinesh Chandar</title>
		<link>http://www.oracloid.com/2006/05/hash-group-by-can-give-wrong-result-in-oracle-102/#comment-17783</link>
		<dc:creator>Dinesh Chandar</dc:creator>
		<pubDate>Fri, 13 Jun 2008 17:05:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.oracloid.com/?p=6#comment-17783</guid>
		<description>When ever you give a group by in Oracle, as far as I remember Oracle used to do a aggregated Sort operation.

I am not sure why it was stopped all of a sudden.

A group by and then a sort by on the "same columns" was not a sensible way of doing it.</description>
		<content:encoded><![CDATA[<p>When ever you give a group by in Oracle, as far as I remember Oracle used to do a aggregated Sort operation.</p>
<p>I am not sure why it was stopped all of a sudden.</p>
<p>A group by and then a sort by on the &#8220;same columns&#8221; was not a sensible way of doing it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex Gorbachev</title>
		<link>http://www.oracloid.com/2006/05/hash-group-by-can-give-wrong-result-in-oracle-102/#comment-17111</link>
		<dc:creator>Alex Gorbachev</dc:creator>
		<pubDate>Tue, 15 Apr 2008 11:36:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.oracloid.com/?p=6#comment-17111</guid>
		<description>I suspect you are expecting them sorted. Right?

In this case, the problem is with your assumptions and not with Oracle. GROUP BY without ORDER BY is not supposed to guarantee ordered results and it never was.

Sorted results, was a side effect until 10g Release 2 because Oracle could only use "SORT GROUP BY" operation. See Metalink Note 361549.1.

You should fix your code. A workaround would be to disable 'hash group by" but this leaves you with really buggy code.</description>
		<content:encoded><![CDATA[<p>I suspect you are expecting them sorted. Right?</p>
<p>In this case, the problem is with your assumptions and not with Oracle. GROUP BY without ORDER BY is not supposed to guarantee ordered results and it never was.</p>
<p>Sorted results, was a side effect until 10g Release 2 because Oracle could only use &#8220;SORT GROUP BY&#8221; operation. See Metalink Note 361549.1.</p>
<p>You should fix your code. A workaround would be to disable &#8216;hash group by&#8221; but this leaves you with really buggy code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dirkey_wynne</title>
		<link>http://www.oracloid.com/2006/05/hash-group-by-can-give-wrong-result-in-oracle-102/#comment-17110</link>
		<dc:creator>dirkey_wynne</dc:creator>
		<pubDate>Tue, 15 Apr 2008 07:53:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.oracloid.com/?p=6#comment-17110</guid>
		<description>I have a question on this. Recently we upgraded to oracle 10.2.0.1. We noticed that some of our tests were failing. Specifically a quite simple test whereby we entered 8 values, with names and numbers, then selected name and number, grouping by num and then name. However after the upgrade, the results were coming out incorrectly, as follows:

name,number
better things,1
karmacoma,1
light my fire,2
protection,1
eurochild,2
unfinished sympathy,3
heat miser,2
weather storm,1

Now, having read here, I surmised that Patch 10.2.0.3 would correct this, and got it installed onto our machine here. However, the issue still has not gone away. The upgrade appeared to go smoothly, everything points to the fact that our DB is on Oracle 10.2.0.3 now, yet our group by still appears to function incorrectly. Any help greatly appreciated!</description>
		<content:encoded><![CDATA[<p>I have a question on this. Recently we upgraded to oracle 10.2.0.1. We noticed that some of our tests were failing. Specifically a quite simple test whereby we entered 8 values, with names and numbers, then selected name and number, grouping by num and then name. However after the upgrade, the results were coming out incorrectly, as follows:</p>
<p>name,number<br />
better things,1<br />
karmacoma,1<br />
light my fire,2<br />
protection,1<br />
eurochild,2<br />
unfinished sympathy,3<br />
heat miser,2<br />
weather storm,1</p>
<p>Now, having read here, I surmised that Patch 10.2.0.3 would correct this, and got it installed onto our machine here. However, the issue still has not gone away. The upgrade appeared to go smoothly, everything points to the fact that our DB is on Oracle 10.2.0.3 now, yet our group by still appears to function incorrectly. Any help greatly appreciated!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andreas Tziovaridis</title>
		<link>http://www.oracloid.com/2006/05/hash-group-by-can-give-wrong-result-in-oracle-102/#comment-6204</link>
		<dc:creator>Andreas Tziovaridis</dc:creator>
		<pubDate>Wed, 21 Feb 2007 19:44:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.oracloid.com/?p=6#comment-6204</guid>
		<description>FYI this is corrected in patch set 3 (10.2.0.3)</description>
		<content:encoded><![CDATA[<p>FYI this is corrected in patch set 3 (10.2.0.3)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Brady</title>
		<link>http://www.oracloid.com/2006/05/hash-group-by-can-give-wrong-result-in-oracle-102/#comment-3623</link>
		<dc:creator>Mark Brady</dc:creator>
		<pubDate>Tue, 19 Dec 2006 17:53:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.oracloid.com/?p=6#comment-3623</guid>
		<description>Yep, in our P&#38;L system... imagine having to restate earnings.</description>
		<content:encoded><![CDATA[<p>Yep, in our P&amp;L system&#8230; imagine having to restate earnings.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex Gorbachev</title>
		<link>http://www.oracloid.com/2006/05/hash-group-by-can-give-wrong-result-in-oracle-102/#comment-321</link>
		<dc:creator>Alex Gorbachev</dc:creator>
		<pubDate>Sun, 08 Oct 2006 02:15:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.oracloid.com/?p=6#comment-321</guid>
		<description>Imaging that bug in your monthly billing procedure. That's where we hit it. ;-)</description>
		<content:encoded><![CDATA[<p>Imaging that bug in your monthly billing procedure. That&#8217;s where we hit it. <img src='http://www.oracloid.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
</channel>
</rss>
