<?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/"
		>
<channel>
	<title>Comments on: Eliminate the Use of Temporary Tables For HUGE Performance Gains</title>
	<atom:link href="http://www.sql-server-performance.com/2002/derived-temp-tables/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sql-server-performance.com/2002/derived-temp-tables/</link>
	<description>SQL Server Performance Tuning</description>
	<lastBuildDate>Fri, 14 Jun 2013 19:09:55 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>By: blah</title>
		<link>http://www.sql-server-performance.com/2002/derived-temp-tables/#comment-1842</link>
		<dc:creator>blah</dc:creator>
		<pubDate>Thu, 19 Apr 2012 18:28:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.sql-server-performance.com/?=183#comment-1842</guid>
		<description><![CDATA[I&#039;ll ditto what others have said.  I use both derived and temp tables.  I run a bunch of procedures start-of-day to double-check some info.  In cases where it&#039;s a small list of stuff to compile for reference, a derived table works like a charm.  But, I found noticeable improvements when I decided to pre-compile a lot of aggregate data early as temp tables which are used in a lot of later queries.  I don&#039;t just make #temp tables, though, I make actual tables in the tempdb.  I use them through-out the day while working on other queries, or ad-hoc&#039;ing something on request.  The checks I run used to take 5 minutes total every day.  After I started temp tableing larger things, it&#039;s down to 1:30, and that includes the time to temp-table the stuff.  As for wear-n-tear on disk I/O and things ... when I do the math for how much time I&#039;m saving, times by how much I get paid by minute ... the company can afford a little wear-n-tear on a hard drive compared to me twiddling my thumbs for an extra 3:30.  (Besides, that 3:30 is enough time for me to get distracted in something else, which kills productivity totally.)]]></description>
		<content:encoded><![CDATA[<p>I&#8217;ll ditto what others have said.  I use both derived and temp tables.  I run a bunch of procedures start-of-day to double-check some info.  In cases where it&#8217;s a small list of stuff to compile for reference, a derived table works like a charm.  But, I found noticeable improvements when I decided to pre-compile a lot of aggregate data early as temp tables which are used in a lot of later queries.  I don&#8217;t just make #temp tables, though, I make actual tables in the tempdb.  I use them through-out the day while working on other queries, or ad-hoc&#8217;ing something on request.  The checks I run used to take 5 minutes total every day.  After I started temp tableing larger things, it&#8217;s down to 1:30, and that includes the time to temp-table the stuff.  As for wear-n-tear on disk I/O and things &#8230; when I do the math for how much time I&#8217;m saving, times by how much I get paid by minute &#8230; the company can afford a little wear-n-tear on a hard drive compared to me twiddling my thumbs for an extra 3:30.  (Besides, that 3:30 is enough time for me to get distracted in something else, which kills productivity totally.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ayan Sengupta</title>
		<link>http://www.sql-server-performance.com/2002/derived-temp-tables/#comment-1210</link>
		<dc:creator>Ayan Sengupta</dc:creator>
		<pubDate>Wed, 11 Jan 2012 12:49:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.sql-server-performance.com/?=183#comment-1210</guid>
		<description><![CDATA[I think the exact opposite for general sql server queries. I have tried a query returning around 7000 rows both using temporary table(even without index) and using derived table.
The difference is significant. Using temporary table takes literally 0ms while the derived table version takes at least 17ms.
One of the bottleneck of the temporary table is of course the locking over entire tempdb. But it never implies that we should avoid that. I suggestion is to use temporary table whenever possible only keeping the locking issue under consideration.]]></description>
		<content:encoded><![CDATA[<p>I think the exact opposite for general sql server queries. I have tried a query returning around 7000 rows both using temporary table(even without index) and using derived table.</p>
<p>The difference is significant. Using temporary table takes literally 0ms while the derived table version takes at least 17ms.</p>
<p>One of the bottleneck of the temporary table is of course the locking over entire tempdb. But it never implies that we should avoid that. I suggestion is to use temporary table whenever possible only keeping the locking issue under consideration.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marcel Drost</title>
		<link>http://www.sql-server-performance.com/2002/derived-temp-tables/#comment-996</link>
		<dc:creator>Marcel Drost</dc:creator>
		<pubDate>Mon, 12 Dec 2011 10:28:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.sql-server-performance.com/?=183#comment-996</guid>
		<description><![CDATA[I have the same experience with Derived tables (Subqueries).
An average select query performs nicely when retrieving all 82000 rows. Execution time is 1 second.
Then I was asked to sum 1 column and to group it on the 2 remaining integer columns.
I tried a derived table, Sum the main query and a temp table.
The Temp Table keeps it in 1 second. The other 2 solutions are within 4/5 minutes.
Thus my question; has any1 have any experience of forcing the query execution plan of the derived table?]]></description>
		<content:encoded><![CDATA[<p>I have the same experience with Derived tables (Subqueries). </p>
<p>An average select query performs nicely when retrieving all 82000 rows. Execution time is 1 second. </p>
<p>Then I was asked to sum 1 column and to group it on the 2 remaining integer columns.</p>
<p>I tried a derived table, Sum the main query and a temp table. </p>
<p>The Temp Table keeps it in 1 second. The other 2 solutions are within 4/5 minutes. </p>
<p>Thus my question; has any1 have any experience of forcing the query execution plan of the derived table?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://www.sql-server-performance.com/2002/derived-temp-tables/#comment-888</link>
		<dc:creator>John</dc:creator>
		<pubDate>Mon, 21 Nov 2011 14:40:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.sql-server-performance.com/?=183#comment-888</guid>
		<description><![CDATA[I agree with Joe as we have experienced the exact opposite effect with large result sets and fairly complex aggregation queries (derived tables) joining against each other. We eliminated the use of derived tables by placing the data into temp tables and took a query that was running for close to 11 hours down to running under 11 seconds. The execution plan indicated the optimizer had no idea what to expect from the derived tables as the actual number of rows was very different from the estimated number of rows.]]></description>
		<content:encoded><![CDATA[<p>I agree with Joe as we have experienced the exact opposite effect with large result sets and fairly complex aggregation queries (derived tables) joining against each other. We eliminated the use of derived tables by placing the data into temp tables and took a query that was running for close to 11 hours down to running under 11 seconds. The execution plan indicated the optimizer had no idea what to expect from the derived tables as the actual number of rows was very different from the estimated number of rows.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nian</title>
		<link>http://www.sql-server-performance.com/2002/derived-temp-tables/#comment-887</link>
		<dc:creator>Nian</dc:creator>
		<pubDate>Mon, 21 Nov 2011 11:24:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.sql-server-performance.com/?=183#comment-887</guid>
		<description><![CDATA[This is completely misleading. Everything exists for a reason or MS wouldn&#039;t have invented temp tables. Derived tables are good for small quantity of data and select operation. When the data volumn is huge and often combined with operations like Group by, temp table can be lot faster by creating and using indexes.]]></description>
		<content:encoded><![CDATA[<p>This is completely misleading. Everything exists for a reason or MS wouldn&#8217;t have invented temp tables. Derived tables are good for small quantity of data and select operation. When the data volumn is huge and often combined with operations like Group by, temp table can be lot faster by creating and using indexes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joe Harris</title>
		<link>http://www.sql-server-performance.com/2002/derived-temp-tables/#comment-796</link>
		<dc:creator>Joe Harris</dc:creator>
		<pubDate>Wed, 02 Nov 2011 11:39:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.sql-server-performance.com/?=183#comment-796</guid>
		<description><![CDATA[This advice is ONLY applicable to OLTP workloads (e.g., small quick transactions). SQL Server &quot;derived tables&quot; (subqueries to everyone else) are **highly** optimised for small SELECTs.
In a DW / ETL / OLAP type workloads the exact **opposite** advice applies. In DW processing I often see HUGE performance gains from converting selects to temp tables.]]></description>
		<content:encoded><![CDATA[<p>This advice is ONLY applicable to OLTP workloads (e.g., small quick transactions). SQL Server &#8220;derived tables&#8221; (subqueries to everyone else) are **highly** optimised for small SELECTs.</p>
<p>In a DW / ETL / OLAP type workloads the exact **opposite** advice applies. In DW processing I often see HUGE performance gains from converting selects to temp tables.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
