<?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: Date handling and limit records found in Oracle</title>
	<atom:link href="http://blog.sixsigns.com/2006/07/13/date-handling-and-limit-records-found-in-oracle/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sixsigns.com/2006/07/13/date-handling-and-limit-records-found-in-oracle/</link>
	<description>Enrich people's lives and web experience</description>
	<pubDate>Wed, 19 Nov 2008 23:38:57 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: Igor</title>
		<link>http://blog.sixsigns.com/2006/07/13/date-handling-and-limit-records-found-in-oracle/#comment-201</link>
		<dc:creator>Igor</dc:creator>
		<pubDate>Fri, 02 May 2008 19:45:41 +0000</pubDate>
		<guid isPermaLink="false">http://wp.econtentpark.com/2006/07/13/Date-handling-and-limit-records-found-in-Oracle#comment-201</guid>
		<description>Does any one know how Oracle  behaves with multiple records for the same date?
Ex.
select * from
(
select * from table order by DateOfBirth
)
Where rownum &#60;11;

Where I have 5 records with the same DOB.</description>
		<content:encoded><![CDATA[<p><!-- google_ad_section_start -->Does any one know how Oracle  behaves with multiple records for the same date?<br />
Ex.<br />
select * from<br />
(<br />
select * from table order by DateOfBirth<br />
)<br />
Where rownum &lt;11;</p>
<p>Where I have 5 records with the same DOB.<!-- google_ad_section_end --></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nitai Aventaggiato</title>
		<link>http://blog.sixsigns.com/2006/07/13/date-handling-and-limit-records-found-in-oracle/#comment-200</link>
		<dc:creator>Nitai Aventaggiato</dc:creator>
		<pubDate>Wed, 09 Jan 2008 13:54:49 +0000</pubDate>
		<guid isPermaLink="false">http://wp.econtentpark.com/2006/07/13/Date-handling-and-limit-records-found-in-Oracle#comment-200</guid>
		<description>This post was missing on our migration to Wordpress. Sorry for that.</description>
		<content:encoded><![CDATA[<p><!-- google_ad_section_start -->This post was missing on our migration to Wordpress. Sorry for that.<!-- google_ad_section_end --></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mitch WRobel</title>
		<link>http://blog.sixsigns.com/2006/07/13/date-handling-and-limit-records-found-in-oracle/#comment-198</link>
		<dc:creator>Mitch WRobel</dc:creator>
		<pubDate>Thu, 21 Jun 2007 03:56:58 +0000</pubDate>
		<guid isPermaLink="false">http://wp.econtentpark.com/2006/07/13/Date-handling-and-limit-records-found-in-Oracle#comment-198</guid>
		<description>&lt;p&gt;This was very helpful. This is the only place on the web to find a &#34;limit&#34; equivalent that doesn't use the rownum. My problem was date related and you hit it right on the nose with your example. Excellent!&#160; I give you mad props!&lt;/p&gt;
&lt;font face="Courier" color="#0000ff" size="2"&gt;
&lt;p&gt;select&lt;/p&gt;
&lt;p&gt;where&lt;/p&gt;
&lt;/font&gt;&lt;font face="Courier" size="2"&gt; * &lt;/font&gt;&lt;font face="Courier" color="#0000ff" size="2"&gt;from&lt;/font&gt;&lt;font face="Courier" size="2"&gt; &lt;/font&gt;&lt;font face="Courier" color="#0000ff" size="2"&gt;(&lt;/font&gt;&lt;font face="Courier" color="#0000ff" size="2"&gt;select&lt;/font&gt;&lt;font face="Courier" size="2"&gt; order_number &lt;/font&gt;&lt;font face="Courier" color="#0000ff" size="2"&gt;,&lt;/font&gt;&lt;font face="Courier" size="2"&gt; ordered_date &lt;/font&gt;&lt;font face="Courier" color="#0000ff" size="2"&gt;from&lt;/font&gt;&lt;font face="Courier" size="2"&gt; oe_order_headers_all &lt;/font&gt;&lt;font face="Courier" color="#0000ff" size="2"&gt;order&lt;/font&gt;&lt;font face="Courier" size="2"&gt; &lt;/font&gt;&lt;font face="Courier" color="#0000ff" size="2"&gt;by&lt;/font&gt;&lt;font face="Courier" size="2"&gt; &lt;/font&gt;&lt;font face="Courier" color="#0000ff" size="2"&gt;least(&lt;/font&gt;&lt;font face="Courier" size="2"&gt;ordered_date&lt;/font&gt;&lt;font face="Courier" color="#0000ff" size="2"&gt;)&lt;/font&gt;&lt;font face="Courier" color="#0000ff" size="2"&gt;)&lt;/font&gt;&lt;font face="Courier" size="2"&gt; &lt;/font&gt;&lt;font face="Courier" color="#0000ff" size="2"&gt;rownum&lt;/font&gt;&lt;font face="Courier" size="2"&gt; &lt;/font&gt;&lt;font face="Courier" color="#0000ff" size="2"&gt;&#60;&lt;/font&gt;&lt;font face="Courier" size="2"&gt; 21&lt;/font&gt;</description>
		<content:encoded><![CDATA[<p><!-- google_ad_section_start -->
<p>This was very helpful. This is the only place on the web to find a &quot;limit&quot; equivalent that doesn&#8217;t use the rownum. My problem was date related and you hit it right on the nose with your example. Excellent!&nbsp; I give you mad props!</p>
<p><font face="Courier" color="#0000ff" size="2"></p>
<p>select</p>
<p>where</p>
<p></font><font face="Courier" size="2"> * </font><font face="Courier" color="#0000ff" size="2">from</font><font face="Courier" size="2"> </font><font face="Courier" color="#0000ff" size="2">(</font><font face="Courier" color="#0000ff" size="2">select</font><font face="Courier" size="2"> order_number </font><font face="Courier" color="#0000ff" size="2">,</font><font face="Courier" size="2"> ordered_date </font><font face="Courier" color="#0000ff" size="2">from</font><font face="Courier" size="2"> oe_order_headers_all </font><font face="Courier" color="#0000ff" size="2">order</font><font face="Courier" size="2"> </font><font face="Courier" color="#0000ff" size="2">by</font><font face="Courier" size="2"> </font><font face="Courier" color="#0000ff" size="2">least(</font><font face="Courier" size="2">ordered_date</font><font face="Courier" color="#0000ff" size="2">)</font><font face="Courier" color="#0000ff" size="2">)</font><font face="Courier" size="2"> </font><font face="Courier" color="#0000ff" size="2">rownum</font><font face="Courier" size="2"> </font><font face="Courier" color="#0000ff" size="2">&lt;</font><font face="Courier" size="2"> 21</font><!-- google_ad_section_end --></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Julian Lawton</title>
		<link>http://blog.sixsigns.com/2006/07/13/date-handling-and-limit-records-found-in-oracle/#comment-199</link>
		<dc:creator>Julian Lawton</dc:creator>
		<pubDate>Thu, 13 Jul 2006 17:52:42 +0000</pubDate>
		<guid isPermaLink="false">http://wp.econtentpark.com/2006/07/13/Date-handling-and-limit-records-found-in-Oracle#comment-199</guid>
		<description>&lt;div&gt;&lt;font size="2"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;One of the cool things about using an outer ROWNUM on an ordered select is that it changes how Oracle optimises it's sorting.&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2"&gt;&#160;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;If we have a set of 70000 records and want the most recent 100, then doing &lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;SELECT * FROM table ORDER BY my_date &lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;and letting the client side code only pull 100 rows from the result set / cursor, still causes Oracle to sort a result set of 70,000 rows.&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2"&gt;&#160;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;SELECT * FROM&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;(&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;SELECT * FROM table ORDER BY my_date &lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;)&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;WHERE rownum &#60;= 100&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2"&gt;&#160;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;means that when it does the sort, it only keeps the top 100 results at any point, which can make huge improvements in performance (cuts down on the risk of having to page out huge temporary sort lists).&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2"&gt;&#160;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;(It's typical of most client-side language programmers to dismiss this feature and just trust JDBC or cursors to do the job).&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;</description>
		<content:encoded><![CDATA[<p><!-- google_ad_section_start -->
<div><font size="2"><span style="FONT-SIZE: 10pt">One of the cool things about using an outer ROWNUM on an ordered select is that it changes how Oracle optimises it&#8217;s sorting.</span></font></div>
<div><font size="2">&nbsp;</font></div>
<div><font size="2"><span style="FONT-SIZE: 10pt">If we have a set of 70000 records and want the most recent 100, then doing </span></font></div>
<div><font size="2"><span style="FONT-SIZE: 10pt">SELECT * FROM table ORDER BY my_date </span></font></div>
<div><font size="2"><span style="FONT-SIZE: 10pt">and letting the client side code only pull 100 rows from the result set / cursor, still causes Oracle to sort a result set of 70,000 rows.</span></font></div>
<div><font size="2">&nbsp;</font></div>
<div><font size="2"><span style="FONT-SIZE: 10pt">SELECT * FROM</span></font></div>
<div><font size="2"><span style="FONT-SIZE: 10pt">(</span></font></div>
<div><font size="2"><span style="FONT-SIZE: 10pt">SELECT * FROM table ORDER BY my_date </span></font></div>
<div><font size="2"><span style="FONT-SIZE: 10pt">)</span></font></div>
<div><font size="2"><span style="FONT-SIZE: 10pt">WHERE rownum &lt;= 100</span></font></div>
<div><font size="2">&nbsp;</font></div>
<div><font size="2"><span style="FONT-SIZE: 10pt">means that when it does the sort, it only keeps the top 100 results at any point, which can make huge improvements in performance (cuts down on the risk of having to page out huge temporary sort lists).</span></font></div>
<div><font size="2">&nbsp;</font></div>
<div><font size="2"><span style="FONT-SIZE: 10pt">(It&#8217;s typical of most client-side language programmers to dismiss this feature and just trust JDBC or cursors to do the job).</span></font></div>
<p><!-- google_ad_section_end --></p>
]]></content:encoded>
	</item>
</channel>
</rss>
