 




<?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: SQL Server Help</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/sql-server-help/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/sql-server-help/</link>
	<description></description>
	<lastBuildDate>Sun, 26 May 2013 01:40:27 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: The Most-Watched IT Questions: September 20, 2011 - ITKE Community Blog</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/sql-server-help/#comment-96808</link>
		<dc:creator>The Most-Watched IT Questions: September 20, 2011 - ITKE Community Blog</dc:creator>
		<pubDate>Tue, 20 Sep 2011 06:42:17 +0000</pubDate>
		<guid isPermaLink="false">#comment-96808</guid>
		<description><![CDATA[[...] 7. Kccrosser, mrdenny, and TomLiotta offer some SQL Server help. [...]]]></description>
		<content:encoded><![CDATA[<p>[...] 7. Kccrosser, mrdenny, and TomLiotta offer some SQL Server help. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cdizl</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/sql-server-help/#comment-96530</link>
		<dc:creator>cdizl</dc:creator>
		<pubDate>Tue, 13 Sep 2011 16:05:14 +0000</pubDate>
		<guid isPermaLink="false">#comment-96530</guid>
		<description><![CDATA[Sorry guys I am not getting the emails when someone comments on this for some reason. Yes this is an attempt to restructure our database before the number of records gets out of hand. For this first time it will be running over the 20 million but after that it should run daily on only new records added to the serial table. Ill try what has been posted and keep you guys updated. Thanks to all!]]></description>
		<content:encoded><![CDATA[<p>Sorry guys I am not getting the emails when someone comments on this for some reason. Yes this is an attempt to restructure our database before the number of records gets out of hand. For this first time it will be running over the 20 million but after that it should run daily on only new records added to the serial table. Ill try what has been posted and keep you guys updated. Thanks to all!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: The Most-Watched IT Questions: September 13, 2011 - ITKE Community Blog</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/sql-server-help/#comment-96500</link>
		<dc:creator>The Most-Watched IT Questions: September 13, 2011 - ITKE Community Blog</dc:creator>
		<pubDate>Tue, 13 Sep 2011 06:17:42 +0000</pubDate>
		<guid isPermaLink="false">#comment-96500</guid>
		<description><![CDATA[[...] One member needed a little SQL server help, so Kccrosser and TomLiotta came to [...]]]></description>
		<content:encoded><![CDATA[<p>[...] One member needed a little SQL server help, so Kccrosser and TomLiotta came to [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kccrosser</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/sql-server-help/#comment-96456</link>
		<dc:creator>kccrosser</dc:creator>
		<pubDate>Mon, 12 Sep 2011 17:59:05 +0000</pubDate>
		<guid isPermaLink="false">#comment-96456</guid>
		<description><![CDATA[TomLiotta has a good point.  If this is a one-time conversion, the above approach isn&#039;t bad.  However, if this is going to be run repeatedly, you need to think about how to improve the process.

At the very least, you need to add some attribute to the source data to know whether that record has been processed or not.  Without some indicator, the process will have to re-run on all 20 million records each time, even if there are only a few thousand new ones to be processed.

Beware adding a simple &quot;flag&quot; to a large table (i.e., a yes/no type of value).  Most database engines don&#039;t like to use indexes on columns that are &quot;non-discriminant&quot; (have few distinct values).  When I have had to deal with this kind of situation, I usually add a numeric column and a sequence.  Set new values to 0 or -1 as an indicator of records to be processed, and then set the processed records to the sequence number when done.

You can then use a compound index on the new flag column + the serial number and get the records to be processed with &quot;select serialno ... where newdata = 0&quot;.  This is extremely efficient with a two-column index - it can actually retrieve the serialno value from the index without even touching the actual data records.]]></description>
		<content:encoded><![CDATA[<p>TomLiotta has a good point.  If this is a one-time conversion, the above approach isn&#8217;t bad.  However, if this is going to be run repeatedly, you need to think about how to improve the process.</p>
<p>At the very least, you need to add some attribute to the source data to know whether that record has been processed or not.  Without some indicator, the process will have to re-run on all 20 million records each time, even if there are only a few thousand new ones to be processed.</p>
<p>Beware adding a simple &#8220;flag&#8221; to a large table (i.e., a yes/no type of value).  Most database engines don&#8217;t like to use indexes on columns that are &#8220;non-discriminant&#8221; (have few distinct values).  When I have had to deal with this kind of situation, I usually add a numeric column and a sequence.  Set new values to 0 or -1 as an indicator of records to be processed, and then set the processed records to the sequence number when done.</p>
<p>You can then use a compound index on the new flag column + the serial number and get the records to be processed with &#8220;select serialno &#8230; where newdata = 0&#8243;.  This is extremely efficient with a two-column index &#8211; it can actually retrieve the serialno value from the index without even touching the actual data records.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/sql-server-help/#comment-96420</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Sun, 11 Sep 2011 09:06:59 +0000</pubDate>
		<guid isPermaLink="false">#comment-96420</guid>
		<description><![CDATA[I should have added that there might be better methods if this is part of a conversion or restructuring. A method that is best for a regularly repeating process is often inappropriate for a process that will run once or only a limited few times. Knowing something about the purpose may lead to different answers.

Tom]]></description>
		<content:encoded><![CDATA[<p>I should have added that there might be better methods if this is part of a conversion or restructuring. A method that is best for a regularly repeating process is often inappropriate for a process that will run once or only a limited few times. Knowing something about the purpose may lead to different answers.</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/sql-server-help/#comment-96324</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Fri, 09 Sep 2011 01:25:19 +0000</pubDate>
		<guid isPermaLink="false">#comment-96324</guid>
		<description><![CDATA[So the purpose is do a kind of conversion that breaks things out into multiple tables? Is this part of an attempt to restructure the database?

Tom]]></description>
		<content:encoded><![CDATA[<p>So the purpose is do a kind of conversion that breaks things out into multiple tables? Is this part of an attempt to restructure the database?</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cdizl</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/sql-server-help/#comment-96299</link>
		<dc:creator>cdizl</dc:creator>
		<pubDate>Thu, 08 Sep 2011 15:58:03 +0000</pubDate>
		<guid isPermaLink="false">#comment-96299</guid>
		<description><![CDATA[I guess the only problem that I am running into is that I just ran the code and it only populated 700 rows in 20 minutes, this definitely will not work if I have 20 million records. It seems like it would be faster than this.]]></description>
		<content:encoded><![CDATA[<p>I guess the only problem that I am running into is that I just ran the code and it only populated 700 rows in 20 minutes, this definitely will not work if I have 20 million records. It seems like it would be faster than this.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 5/8 queries in 0.019 seconds using memcached
Object Caching 353/354 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-26 05:46:28 -->