<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1416983219169300553</id><updated>2011-11-27T16:56:09.075-08:00</updated><category term='performance tips'/><category term='tb'/><category term='sp_MSforeachtable'/><category term='inserts'/><category term='sql server 2000'/><category term='cte limitations'/><category term='SQL Server 2005'/><category term='new'/><category term='ansi standard join'/><category term='transact-sql'/><category term='programming CTE'/><category term='data warehouse'/><category term='context'/><category term='mass updates'/><category term='concurrency'/><category term='book'/><category term='profiler sys.trace_events eventclass'/><category term='ctes'/><category term='common table expression'/><category term='DBA support task list'/><category term='t-sql'/><category term='sql server 2008'/><category term='developers'/><category term='sql'/><category term='join syntax'/><category term='DBREINDEX'/><category term='features'/><category term='server'/><category term='terabyte'/><category term='performance'/><category term='Jeff Garbus'/><category term='data load'/><category term='2008'/><category term='table perforamance'/><category term='cte'/><category term='indexdefrag'/><title type='text'>SQL Server Performance</title><subtitle type='html'>Performance tips for beginner through guru programmers and DBAs using Microsoft SQL Server</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://mssqlperformance.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1416983219169300553/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://mssqlperformance.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Jeff Garbus</name><uri>http://www.blogger.com/profile/09795382811630904379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_CiO9OPlBx6k/SX4dHyMeoiI/AAAAAAAAAAM/Lw3nS23Mpdc/S220/DSC_0243.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>13</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1416983219169300553.post-1916023141925237974</id><published>2010-05-24T10:47:00.001-07:00</published><updated>2010-05-24T10:47:47.991-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DBA support task list'/><title type='text'>Why you need DBA support</title><content type='html'>Almost every shop is short-handed these days; DBAs in particular, since we're often on call, tend to be a bit... stretched. I wrote this in an attempt to explain to non-DBAs what it is we do, and why it is important to have us around &amp;amp; functional (i.e. not burned out!). Please share as you will. email me for a word or pdf version.&lt;br /&gt;&lt;br /&gt;Why you need DBA support&lt;br /&gt;There seem to be patterns and cycles in everything. Application development is no exception. For a variety of reasons, organizations of all sizes frequently end up without a DBA.&lt;br /&gt;Lack of a DBA will put organizations at risk in a variety of ways:&lt;br /&gt;·         Performance issues, slowly snowballing (or suddenly escalating) until they are intolerable&lt;br /&gt;·         Phases of development which become increasingly difficult because the design of the data model did not lend itself to flexibility&lt;br /&gt;·         Database corruption, system crash, or other disasters, often to find out that there is no backup, or nobody who knows how to deal with a system down issue&lt;br /&gt;·         When your production database goes down, your business stops&lt;br /&gt;·         … or a hundred other scenarios&lt;br /&gt;Here, in no particular order of importance, is a Letterman-esque Top 10 List of the reasons that you need a DBA or DBA managed support services:&lt;br /&gt;Preventive Maintenance&lt;br /&gt;Servers and databases need to be properly maintained. When they are not, performance degrades, database consistency is at risk, and cleanup of ancillary processes (for example, growth of the database log) doesn’t occur; it can take a while, but little things can fill up disk subsystems and cause database management systems to halt.&lt;br /&gt;Application Performance&lt;br /&gt;Do you know how to identify what application components are running slowly? When users call and complain about performance, where do you look? Where are the bottlenecks? Is it CPU, memory, disk, network? Even after you’ve identified the component, what is causing the CPU to spike? Answering these questions can be… nontrivial. A common mistake here is to “throw hardware at the problem,” which will not help, may or may not mask the problem for a short period while it snowballs out of control.&lt;br /&gt;Disaster Recovery&lt;br /&gt;Do you have a disaster recovery plan? You’re probably performing backups. When is the last time you tested the restoration procedure? I’ve had more than one new customer retain me just because the restore didn’t work. Did you know that a DBMS can give you point-in-time recovery? Just because somebody deletes a table may not mean it is gone forever, if you plan properly.&lt;br /&gt;Device Management&lt;br /&gt;We tend to treat IO as a bottleneck. How do you maximize throughput? There are a variety of DBMS resources that require frequent IO, including data, logs, indexes, and even to the DBMS executable itself. How are you going to balance the IO across your devices? What are you going to do when your SAN administrators tell you that the SAN is not being stressed, but your DBMS is telling you that there is an IO bottleneck? This happens too often.&lt;br /&gt;Predictive Analysis&lt;br /&gt;When do you need to buy more disk? CPU? Upgrade your hardware? If you’re not measuring / monitoring database growth and a dozen other factors, while managing performance (so that you don’t get false reads), you simply don’t have any way to plan.&lt;br /&gt;Physical Architecture&lt;br /&gt;What makes more sense for you? Clustering? Warm standby replication? Balancing your workloads across multiple machines? Consolidating your servers? These decisions need to be based upon facts, knowledge of your business requirements, and experience.  If you don’t have a DBA on staff, or have DBAs in a support model, then you won’t know the right way to respond.&lt;br /&gt;Application architecture&lt;br /&gt;DBAs are great resources when you start to design your application flow. How are you going to bring data together from disparate data sources? How aware are you of your real-time and batch options? How many have you direct experience with?&lt;br /&gt;Business continuity&lt;br /&gt;We recently read a statistic that stated that over 60% of businesses fail after catastrophic data loss. Where were you when the hurricane hit your data center? Worse, where was your data, and how did you continue to function? You need to plan, long term, for hurricanes, fires, floods theft, and other flavors of disaster.&lt;br /&gt;Hardware Performance&lt;br /&gt;When ordering your server hardware, you need to know what the DBMS performance has been over time; you need to know which performance spikes are aberrations and what is normal; you need to know how to maximize the throughput throughout your bottlenecks, by fine tuning cache or other physical resources.  Without a DBA, you just won’t know.&lt;br /&gt;Developer training&lt;br /&gt;An oft-neglected but badly-needed area of DBA work is the mentoring of developers, who, as a group, have a very high aptitude for logical coding, but often do not have training in database performance. This often leads to passed user acceptance testing, with significant performance issues at rollout. Worse, the performance issues tend to snowball, as the poor code often propagates.&lt;br /&gt;Summary&lt;br /&gt;This short-list of critical DBA activities requires dedicated support. A developer who is a part-time DBA, even with sufficient background, usually won’t have sufficient time to perform these tasks.&lt;br /&gt;Whether you go with a full-time DBA or managed DB support services, make sure you have adequate expertise at hand.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1416983219169300553-1916023141925237974?l=mssqlperformance.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mssqlperformance.blogspot.com/feeds/1916023141925237974/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mssqlperformance.blogspot.com/2010/05/why-you-need-dba-support.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1416983219169300553/posts/default/1916023141925237974'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1416983219169300553/posts/default/1916023141925237974'/><link rel='alternate' type='text/html' href='http://mssqlperformance.blogspot.com/2010/05/why-you-need-dba-support.html' title='Why you need DBA support'/><author><name>Jeff Garbus</name><uri>http://www.blogger.com/profile/09795382811630904379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_CiO9OPlBx6k/SX4dHyMeoiI/AAAAAAAAAAM/Lw3nS23Mpdc/S220/DSC_0243.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1416983219169300553.post-3560471432639264350</id><published>2010-04-05T07:38:00.001-07:00</published><updated>2010-04-05T07:42:00.548-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='t-sql'/><category scheme='http://www.blogger.com/atom/ns#' term='Jeff Garbus'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='transact-sql'/><category scheme='http://www.blogger.com/atom/ns#' term='book'/><title type='text'>Microsoft Transact-SQL: The Definitive Guide is coming off the presses shortly</title><content type='html'>subtitled: How to rewrite bad t-sql code...&lt;br /&gt;&lt;br /&gt;Here's the link:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.jbpub.com/catalog/9780763784164/"&gt;http://www.jbpub.com/catalog/9780763784164/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If I get a discount code, I'll put it here...&lt;br /&gt;&lt;br /&gt;This is a great book for folks looking to teach application developers how to rewrite their code more efficiently; you should buy a case of these to hand out to your development teams :-)&lt;br /&gt;&lt;br /&gt;Jeff&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1416983219169300553-3560471432639264350?l=mssqlperformance.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mssqlperformance.blogspot.com/feeds/3560471432639264350/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mssqlperformance.blogspot.com/2010/04/ultimate-guide-to-transact-sql-coming.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1416983219169300553/posts/default/3560471432639264350'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1416983219169300553/posts/default/3560471432639264350'/><link rel='alternate' type='text/html' href='http://mssqlperformance.blogspot.com/2010/04/ultimate-guide-to-transact-sql-coming.html' title='Microsoft Transact-SQL: The Definitive Guide is coming off the presses shortly'/><author><name>Jeff Garbus</name><uri>http://www.blogger.com/profile/09795382811630904379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_CiO9OPlBx6k/SX4dHyMeoiI/AAAAAAAAAAM/Lw3nS23Mpdc/S220/DSC_0243.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1416983219169300553.post-6322928849078603143</id><published>2009-12-15T10:56:00.001-08:00</published><updated>2009-12-15T10:57:31.955-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='profiler sys.trace_events eventclass'/><title type='text'>Mapping Events to Event IDs from a Profiler Trace</title><content type='html'>Tracked this one down, now I'm sharing:&lt;br /&gt;&lt;br /&gt;select name, count(*)&lt;br /&gt;from dbo.TraceTable20091214 tr join sys.trace_events&lt;br /&gt;on trace_event_id = eventclass&lt;br /&gt;group by name&lt;br /&gt;order by 2 desc&lt;br /&gt;&lt;br /&gt;sys.trace_events picks up the name of the event_id, which is what gets stored in the profiler trace log.&lt;br /&gt;&lt;br /&gt;enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1416983219169300553-6322928849078603143?l=mssqlperformance.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mssqlperformance.blogspot.com/feeds/6322928849078603143/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mssqlperformance.blogspot.com/2009/12/mapping-events-to-event-ids-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1416983219169300553/posts/default/6322928849078603143'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1416983219169300553/posts/default/6322928849078603143'/><link rel='alternate' type='text/html' href='http://mssqlperformance.blogspot.com/2009/12/mapping-events-to-event-ids-from.html' title='Mapping Events to Event IDs from a Profiler Trace'/><author><name>Jeff Garbus</name><uri>http://www.blogger.com/profile/09795382811630904379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_CiO9OPlBx6k/SX4dHyMeoiI/AAAAAAAAAAM/Lw3nS23Mpdc/S220/DSC_0243.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1416983219169300553.post-6015975051290324596</id><published>2009-10-04T19:26:00.000-07:00</published><updated>2009-10-04T20:01:28.652-07:00</updated><title type='text'>SQL Saturday #21 in Orlando, 10/17/2009</title><content type='html'>Hi,&lt;br /&gt;&lt;br /&gt;You've seen this post before...&lt;br /&gt;&lt;br /&gt;I'm giving my index talks in Orlando again in October... hope to see you there! Send me a note if you want an outline, or better yet, go to&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.sqlsaturday.com/"&gt;www.sqlsaturday.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;for an outline and to register. Hope to see you there.&lt;br /&gt;&lt;br /&gt;Jeff&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1416983219169300553-6015975051290324596?l=mssqlperformance.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mssqlperformance.blogspot.com/feeds/6015975051290324596/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mssqlperformance.blogspot.com/2009/10/sql-saturday-21-in-orlando-10172009.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1416983219169300553/posts/default/6015975051290324596'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1416983219169300553/posts/default/6015975051290324596'/><link rel='alternate' type='text/html' href='http://mssqlperformance.blogspot.com/2009/10/sql-saturday-21-in-orlando-10172009.html' title='SQL Saturday #21 in Orlando, 10/17/2009'/><author><name>Jeff Garbus</name><uri>http://www.blogger.com/profile/09795382811630904379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_CiO9OPlBx6k/SX4dHyMeoiI/AAAAAAAAAAM/Lw3nS23Mpdc/S220/DSC_0243.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1416983219169300553.post-7582828105168913178</id><published>2009-08-03T20:29:00.000-07:00</published><updated>2009-08-03T20:31:10.234-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='terabyte'/><category scheme='http://www.blogger.com/atom/ns#' term='data load'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='data warehouse'/><category scheme='http://www.blogger.com/atom/ns#' term='tb'/><title type='text'>Load a 1Tb database in 30 minutes!</title><content type='html'>Some links deserver their own blog post. This one was passed on to me by a client, it's teriffic, you should read it immediately.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://technet.microsoft.com/en-us/library/dd537533.aspx"&gt;http://technet.microsoft.com/en-us/library/dd537533.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1416983219169300553-7582828105168913178?l=mssqlperformance.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mssqlperformance.blogspot.com/feeds/7582828105168913178/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mssqlperformance.blogspot.com/2009/08/load-1tb-database-in-30-minutes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1416983219169300553/posts/default/7582828105168913178'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1416983219169300553/posts/default/7582828105168913178'/><link rel='alternate' type='text/html' href='http://mssqlperformance.blogspot.com/2009/08/load-1tb-database-in-30-minutes.html' title='Load a 1Tb database in 30 minutes!'/><author><name>Jeff Garbus</name><uri>http://www.blogger.com/profile/09795382811630904379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_CiO9OPlBx6k/SX4dHyMeoiI/AAAAAAAAAAM/Lw3nS23Mpdc/S220/DSC_0243.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1416983219169300553.post-4027084868733874561</id><published>2009-08-03T20:19:00.000-07:00</published><updated>2009-08-03T20:29:13.209-07:00</updated><title type='text'>SQL Saturday in Miami</title><content type='html'>Miami anybody?&lt;br /&gt;&lt;br /&gt;I'm speaking at SQL Saturday in Miami on 8/8, go to sqlsaturday.com to register &amp;amp; for details if you haven't already.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1416983219169300553-4027084868733874561?l=mssqlperformance.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mssqlperformance.blogspot.com/feeds/4027084868733874561/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mssqlperformance.blogspot.com/2009/08/sql-saturday-in-miami.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1416983219169300553/posts/default/4027084868733874561'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1416983219169300553/posts/default/4027084868733874561'/><link rel='alternate' type='text/html' href='http://mssqlperformance.blogspot.com/2009/08/sql-saturday-in-miami.html' title='SQL Saturday in Miami'/><author><name>Jeff Garbus</name><uri>http://www.blogger.com/profile/09795382811630904379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_CiO9OPlBx6k/SX4dHyMeoiI/AAAAAAAAAAM/Lw3nS23Mpdc/S220/DSC_0243.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1416983219169300553.post-5314964521811336901</id><published>2009-03-03T12:47:00.000-08:00</published><updated>2009-03-03T12:55:03.728-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mass updates'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='concurrency'/><title type='text'>Concurrency issues during massive updates / archiving</title><content type='html'>Mass updates / mass deltes often cause contention issue with locking / blocking. One technique I suggest to my students is to update / delete parts of the table at a time, &lt;em&gt;where feasible&lt;/em&gt;, so as to avoid embarassing issues like table locks.&lt;br /&gt;&lt;br /&gt;The following code could be improved, but it has the right general idea: For each involved table, delete 1000 rows at a time until we're done.&lt;br /&gt;&lt;br /&gt;CREATE PROCEDURE [dbo].[DeleteSnapshotData]&lt;br /&gt;      @I_lNumDays int&lt;br /&gt;AS&lt;br /&gt;&lt;br /&gt;SET NOCOUNT ON&lt;br /&gt;-- get cutoff date string&lt;br /&gt;declare @tablename varchar(50)&lt;br /&gt;declare @dtCutoff smalldatetime&lt;br /&gt;declare @strCutoff varchar(50)&lt;br /&gt;declare @command nvarchar(2000)&lt;br /&gt;set @dtCutoff = getdate() - @I_lNumDays&lt;br /&gt;set @strCutoff = cast(year(@dtCutoff) as varchar) + '-' + right('00' + cast(month(@dtCutoff) as varchar), 2) + '-' + right('00' + cast(day(@dtCutoff) as varchar), 2)&lt;br /&gt;&lt;br /&gt;-- build temp table&lt;br /&gt;set rowcount 0&lt;br /&gt;select sysobjects.name into #snapshots from sysobjects join syscolumns on sysobjects.id = syscolumns.id where sysobjects.name like '%snapshot%'  and (OBJECTPROPERTY(sysobjects.id, N'IsTable') = 1) and (syscolumns.name = 'tdate')&lt;br /&gt;&lt;br /&gt;set rowcount 1&lt;br /&gt;select @tablename = name from #snapshots&lt;br /&gt;&lt;br /&gt;while @@rowcount &gt; 0&lt;br /&gt;begin&lt;br /&gt;&lt;br /&gt;      delete from #snapshots where name = @tablename&lt;br /&gt;      if ((@tablename != 'Closing_Charges_Snapshot') and (@tablename != 'Closing_Credits_Snapshot'))&lt;br /&gt;      BEGIN&lt;br /&gt;            print 'deleting expired data from ' + @tablename + '...'&lt;br /&gt;     &lt;br /&gt;            SET ROWCOUNT 1000&lt;br /&gt;            WHILE (1=1)&lt;br /&gt;            BEGIN&lt;br /&gt;                  BEGIN TRANSACTION&lt;br /&gt;                  SET NOCOUNT OFF&lt;br /&gt;                  select @command = N'delete from ' + @tablename + ' where tdate &lt; ''' + @strCutoff + ''''&lt;br /&gt;                        exec (@command)&lt;br /&gt;           &lt;br /&gt;                  IF @@ROWCOUNT = 0&lt;br /&gt;                  BEGIN&lt;br /&gt;                        COMMIT TRANSACTION&lt;br /&gt;                        BREAK&lt;br /&gt;                  END&lt;br /&gt;                 &lt;br /&gt;                  COMMIT TRANSACTION&lt;br /&gt;            END&lt;br /&gt;      END&lt;br /&gt;      SET NOCOUNT ON&lt;br /&gt;      set rowcount 1&lt;br /&gt;      select @tablename = name from #snapshots&lt;br /&gt;end&lt;br /&gt;drop table #snapshots&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1416983219169300553-5314964521811336901?l=mssqlperformance.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mssqlperformance.blogspot.com/feeds/5314964521811336901/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mssqlperformance.blogspot.com/2009/03/concurrency-issues-during-massive.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1416983219169300553/posts/default/5314964521811336901'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1416983219169300553/posts/default/5314964521811336901'/><link rel='alternate' type='text/html' href='http://mssqlperformance.blogspot.com/2009/03/concurrency-issues-during-massive.html' title='Concurrency issues during massive updates / archiving'/><author><name>Jeff Garbus</name><uri>http://www.blogger.com/profile/09795382811630904379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_CiO9OPlBx6k/SX4dHyMeoiI/AAAAAAAAAAM/Lw3nS23Mpdc/S220/DSC_0243.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1416983219169300553.post-7481659052048173284</id><published>2009-03-02T12:42:00.000-08:00</published><updated>2009-03-02T12:58:29.954-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DBREINDEX'/><category scheme='http://www.blogger.com/atom/ns#' term='indexdefrag'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='sp_MSforeachtable'/><category scheme='http://www.blogger.com/atom/ns#' term='table perforamance'/><title type='text'>Undocumented system procedure</title><content type='html'>Critical path for most folks is preventive maintenance, whether they know it or not.&lt;br /&gt;&lt;br /&gt;If you're ever looking for a quick way of doing something on all (user) tables in a database, there's a system stored procedure for it.&lt;br /&gt;&lt;br /&gt;EXEC sp_MSforeachtable @command1="print '?' DBCC DBREINDEX ('?', ' ', 80)"&lt;br /&gt;&lt;br /&gt;This command will run the "dbcc DBREINDEX" command on each table in the database.&lt;br /&gt;&lt;br /&gt;Your table-level preventive maintenance regiman, CRUCIAL to performance success, include:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;keeping all table statistics up to date&lt;/li&gt;&lt;li&gt;Keeping index structures balanced; this may be an indexdefrag (which, while intrusive, can be performed online) or preferably by rebuilding indexes (dbcc DBREINDEX )&lt;/li&gt;&lt;li&gt;Making sure you have the indexes you need, and remove indexes you don't use (see new managment views for that!)&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1416983219169300553-7481659052048173284?l=mssqlperformance.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mssqlperformance.blogspot.com/feeds/7481659052048173284/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mssqlperformance.blogspot.com/2009/03/undocumented-system-procedure.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1416983219169300553/posts/default/7481659052048173284'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1416983219169300553/posts/default/7481659052048173284'/><link rel='alternate' type='text/html' href='http://mssqlperformance.blogspot.com/2009/03/undocumented-system-procedure.html' title='Undocumented system procedure'/><author><name>Jeff Garbus</name><uri>http://www.blogger.com/profile/09795382811630904379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_CiO9OPlBx6k/SX4dHyMeoiI/AAAAAAAAAAM/Lw3nS23Mpdc/S220/DSC_0243.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1416983219169300553.post-3210245017190474273</id><published>2009-02-26T12:28:00.000-08:00</published><updated>2009-02-26T12:39:30.432-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql server 2000'/><category scheme='http://www.blogger.com/atom/ns#' term='ansi standard join'/><category scheme='http://www.blogger.com/atom/ns#' term='performance tips'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='join syntax'/><title type='text'>SQL Yesterday vs. SQL Today</title><content type='html'>Quick Tip: Use the ANSI Standard Join syntax in all of your queries.&lt;br /&gt;&lt;br /&gt;I've been writing SQL for abotu 20 years now, and have been forcing my hands to type the new code. It's not just a good idea; it's now critical to performance. I've talked to hosts of people who claim that their performance has improved by changing format from the old syntax (where joincol = joincol) to the new syntax (ON joincol = joincol) ... I'm sure the "Why" has been documented / blogged about, so I'll just leave the top &amp;amp; a sample correction here...&lt;br /&gt;&lt;br /&gt;Reproduced here with the client's permission:&lt;br /&gt;&lt;br /&gt;SELECT&lt;br /&gt;      Facilities.code, Facilities.name, Trips.veh, Trips.status, Trips.priority, Trips.tdate,&lt;br /&gt;      Trips.dstatus, Facilities.initials, Trips.dispdate, Trips.disptime, Trips.enrdate,&lt;br /&gt;      Trips.enrtime, Trips.atsdate, Trips.atstime, Trips.atddate, Trips.atdtime, Trips.tradate,&lt;br /&gt;      Trips.tratime, Trips.cmpy, Trips.daddr2, Trips.daddr, Trips.avldate, Trips.avltime,&lt;br /&gt;      Trips.IncidentID, Trips.RunNumber, Notes.NoteDate, Notes.Description,&lt;br /&gt;      Trips.transpriority&lt;br /&gt;FROM&lt;br /&gt;      dbo.Facilities Facilities, dbo.Trips Trips, dbo.TripNotes Tripnotes, dbo.Notes Notes&lt;br /&gt;WHERE&lt;br /&gt;      Trips.dfac = Facilities.code AND&lt;br /&gt;      Tripnotes.job = Trips.job AND&lt;br /&gt;      Notes.code = Tripnotes.note AND&lt;br /&gt;      Trips.tdate = Tripnotes.tdate AND&lt;br /&gt;      (&lt;br /&gt;            Trips.dstatus IN (4,5,6) AND&lt;br /&gt;            Trips.tdate &gt;= convert(char(10),getdate()-1,126) AND&lt;br /&gt;            Facilities.code &lt;&gt; 1&lt;br /&gt;      )&lt;br /&gt;&lt;br /&gt;And recommend it be rewritten like this:&lt;br /&gt;&lt;br /&gt;SELECT&lt;br /&gt;      Facilities.code, Facilities.name, Trips.veh, Trips.status, Trips.priority, Trips.tdate,&lt;br /&gt;      Trips.dstatus, Facilities.initials, Trips.dispdate, Trips.disptime, Trips.enrdate,&lt;br /&gt;      Trips.enrtime, Trips.atsdate, Trips.atstime, Trips.atddate, Trips.atdtime, Trips.tradate,&lt;br /&gt;      Trips.tratime, Trips.cmpy, Trips.daddr2, Trips.daddr, Trips.avldate, Trips.avltime,&lt;br /&gt;      Trips.IncidentID, Trips.RunNumber, Notes.NoteDate, Notes.Description,&lt;br /&gt;      Trips.transpriority&lt;br /&gt;FROM&lt;br /&gt;      dbo.Facilities Facilities join dbo.Trips Trips on&lt;br /&gt;                  Trips.dfac = Facilities.code JOIN&lt;br /&gt;      dbo.TripNotes Tripnotes on&lt;br /&gt;            Trips.job = Tripnotes.job AND&lt;br /&gt;            Trips.tdate = Tripnotes.tdate JOIN&lt;br /&gt;      dbo.Notes Notes ON&lt;br /&gt;            Notes.code = Tripnotes.note &lt;br /&gt;WHERE&lt;br /&gt;            Trips.dstatus IN (4,5,6) AND&lt;br /&gt;            Trips.tdate &gt;= convert(char(10),getdate()-1,126) AND&lt;br /&gt;            Facilities.code &lt;&gt; 1&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1416983219169300553-3210245017190474273?l=mssqlperformance.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mssqlperformance.blogspot.com/feeds/3210245017190474273/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mssqlperformance.blogspot.com/2009/02/sql-yesterday-vs-sql-today.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1416983219169300553/posts/default/3210245017190474273'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1416983219169300553/posts/default/3210245017190474273'/><link rel='alternate' type='text/html' href='http://mssqlperformance.blogspot.com/2009/02/sql-yesterday-vs-sql-today.html' title='SQL Yesterday vs. SQL Today'/><author><name>Jeff Garbus</name><uri>http://www.blogger.com/profile/09795382811630904379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_CiO9OPlBx6k/SX4dHyMeoiI/AAAAAAAAAAM/Lw3nS23Mpdc/S220/DSC_0243.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1416983219169300553.post-3296883883512830168</id><published>2009-02-19T18:05:00.000-08:00</published><updated>2009-02-19T18:20:32.087-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ctes'/><category scheme='http://www.blogger.com/atom/ns#' term='cte limitations'/><category scheme='http://www.blogger.com/atom/ns#' term='programming CTE'/><category scheme='http://www.blogger.com/atom/ns#' term='common table expression'/><category scheme='http://www.blogger.com/atom/ns#' term='cte'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 2005'/><title type='text'>Common Table Expressions (CTE) in SQL Server 2005 &amp; 2008</title><content type='html'>From 2008 Books Online:&lt;br /&gt;&lt;br /&gt;A common table expression (CTE) can be thought of as a temporary result set that is defined within the execution scope of a single SELECT, INSERT, UPDATE, DELETE, or CREATE VIEW statement. A CTE is similar to a derived table in that it is not stored as an object and lasts only for the duration of the query. Unlike a derived table, a CTE can be self-referencing and can be referenced multiple times in the same query.&lt;br /&gt;&lt;br /&gt;The really cool part of this is the self-referencing part.&lt;br /&gt;&lt;br /&gt;I'm not going to try to teach you CTE here. Honestly, it's been done too well already. Here's a link to a favorite:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.simple-talk.com/sql/sql-server-2005/sql-server-2005-common-table-expressions/"&gt;http://www.simple-talk.com/sql/sql-server-2005/sql-server-2005-common-table-expressions/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It does reference a few other documents (like I did with books online, above), again so as not to reinvent the wheel.&lt;br /&gt;&lt;br /&gt;I wanted to share a couple of limitations in CTEs that I encountered this past week.&lt;br /&gt;&lt;br /&gt;Requirement: Unlimited self-referencing / recursion in object definitions.&lt;br /&gt;&lt;br /&gt;With the self-referencing objects, the problem that you have is the circular reference. With a CTE, you can limit this by specifying a recursion limit (i.e. "circle no more than X times").&lt;br /&gt;&lt;br /&gt;Is this a good idea? Does it make sense to circle multiple passes through a set of objects once you've already collected all of the objects?&lt;br /&gt;&lt;br /&gt;We ended up (in SQL 2005) using a temp table implementation (well, really, memory table not temp table). The reason: we needed to be able to say, "grab the next set of child relationships, but ONLY if we haven't already grabbed those relationships." The CTE limitation in sql 2005 doesn't allow mulitple recursive references.&lt;br /&gt;&lt;br /&gt;Imagine my delight when I read the above: "...can be referenced multiple times in the same query,,," ... this in and of itself is enough to talk this particular client into going to SQL Server 2008.&lt;br /&gt;&lt;br /&gt;Happy CTEs...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1416983219169300553-3296883883512830168?l=mssqlperformance.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mssqlperformance.blogspot.com/feeds/3296883883512830168/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mssqlperformance.blogspot.com/2009/02/common-table-expressions-cte-in-sql.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1416983219169300553/posts/default/3296883883512830168'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1416983219169300553/posts/default/3296883883512830168'/><link rel='alternate' type='text/html' href='http://mssqlperformance.blogspot.com/2009/02/common-table-expressions-cte-in-sql.html' title='Common Table Expressions (CTE) in SQL Server 2005 &amp; 2008'/><author><name>Jeff Garbus</name><uri>http://www.blogger.com/profile/09795382811630904379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_CiO9OPlBx6k/SX4dHyMeoiI/AAAAAAAAAAM/Lw3nS23Mpdc/S220/DSC_0243.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1416983219169300553.post-6782842137027938851</id><published>2009-02-03T04:57:00.000-08:00</published><updated>2009-02-03T05:02:03.193-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql'/><category scheme='http://www.blogger.com/atom/ns#' term='features'/><category scheme='http://www.blogger.com/atom/ns#' term='developers'/><category scheme='http://www.blogger.com/atom/ns#' term='new'/><category scheme='http://www.blogger.com/atom/ns#' term='2008'/><title type='text'>SQL 2008 new features for developers</title><content type='html'>I was recently asked to outline a "New Features for SQL 2008 for Developers" course... this is not strictly perormance related, and you can certainly get this list from other sources... and if you want detail, go to microsoft.com... and in fact, if you want detail, you'll have to go there... but if you're interested in a concise list, here it is:&lt;br /&gt;&lt;br /&gt;SQL Server 2008 New features for developers&lt;br /&gt;3 days&lt;br /&gt;Topics:&lt;br /&gt;&lt;br /&gt;- Auditing&lt;br /&gt;- Change tracking&lt;br /&gt;- Resource governor&lt;br /&gt;- Compressed data and indexes&lt;br /&gt;- Filestream storage&lt;br /&gt;- Partition switching&lt;br /&gt;- Sparse columns&lt;br /&gt;- Spatial data storage&lt;br /&gt;- Wide tables&lt;br /&gt;- New data types&lt;br /&gt;- Full text search enhancements&lt;br /&gt;- Compound operators&lt;br /&gt;- Grouping sets&lt;br /&gt;- Merge statement&lt;br /&gt;- SQL Dependency reporting&lt;br /&gt;- Table-values parameters&lt;br /&gt;- T-SQL Row Constructors&lt;br /&gt;- Filtered indexes&lt;br /&gt;- Data encryption enhancements&lt;br /&gt;- LINQ&lt;br /&gt;&lt;br /&gt;(For more detail, check out our training web site later, www.soaringeagle.com/training)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1416983219169300553-6782842137027938851?l=mssqlperformance.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mssqlperformance.blogspot.com/feeds/6782842137027938851/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mssqlperformance.blogspot.com/2009/02/sql-2008-new-features-for-developers.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1416983219169300553/posts/default/6782842137027938851'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1416983219169300553/posts/default/6782842137027938851'/><link rel='alternate' type='text/html' href='http://mssqlperformance.blogspot.com/2009/02/sql-2008-new-features-for-developers.html' title='SQL 2008 new features for developers'/><author><name>Jeff Garbus</name><uri>http://www.blogger.com/profile/09795382811630904379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_CiO9OPlBx6k/SX4dHyMeoiI/AAAAAAAAAAM/Lw3nS23Mpdc/S220/DSC_0243.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1416983219169300553.post-1205975501062328643</id><published>2009-01-30T12:35:00.001-08:00</published><updated>2009-01-30T12:37:02.773-08:00</updated><title type='text'>Free Webinar Series</title><content type='html'>Hi,&lt;br /&gt;&lt;br /&gt;Please register to join our webinar series, great for anybody who ever does any T-SQL programming, free to anybody who finds my blog, email &lt;a href="mailto:webinar@soaringeagle.biz"&gt;webinar@soaringeagle.biz&lt;/a&gt; to register:&lt;br /&gt;&lt;br /&gt;About the Accelerated SQL Performance Series&lt;br /&gt;Noted author, lecturer and consultant Jeffrey Garbus is hosting a 6 week webinar series to help you improve SQL performance.  Jeff has spent 20 years helping organizations of all sizes and industries maximize database performance. If you saw him speak at the conference, you already know that your time investment for these sessions will reap rich dividends.&lt;br /&gt;&lt;br /&gt;These 30 minute sessions will directly help you address performance issues and give you the tools to get even greater performance out of your design.&lt;br /&gt;&lt;br /&gt;Beginning on Tuesday February 10, 2009, at 12:15 PM, the series will run weekly for 6 consecutive weeks at lunchtime.&lt;br /&gt;&lt;br /&gt;The series will include:&lt;br /&gt;1)      Clustered vs. non-clustered indexes&lt;br /&gt;2)      Choosing indexes in a single-table query environment&lt;br /&gt;3)      Choosing indexes for join optimization&lt;br /&gt;4)      Stored procedures &amp;amp; performance&lt;br /&gt;5)      Writing characteristic &amp;amp; determinate functions&lt;br /&gt;6)      Table design &amp;amp; performance&lt;br /&gt;&lt;br /&gt;Space is limited so register today.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1416983219169300553-1205975501062328643?l=mssqlperformance.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mssqlperformance.blogspot.com/feeds/1205975501062328643/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mssqlperformance.blogspot.com/2009/01/free-webinar-series.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1416983219169300553/posts/default/1205975501062328643'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1416983219169300553/posts/default/1205975501062328643'/><link rel='alternate' type='text/html' href='http://mssqlperformance.blogspot.com/2009/01/free-webinar-series.html' title='Free Webinar Series'/><author><name>Jeff Garbus</name><uri>http://www.blogger.com/profile/09795382811630904379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_CiO9OPlBx6k/SX4dHyMeoiI/AAAAAAAAAAM/Lw3nS23Mpdc/S220/DSC_0243.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1416983219169300553.post-2663642831929107735</id><published>2009-01-26T11:33:00.000-08:00</published><updated>2009-01-26T11:52:38.377-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql'/><category scheme='http://www.blogger.com/atom/ns#' term='server'/><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='context'/><category scheme='http://www.blogger.com/atom/ns#' term='inserts'/><title type='text'>Context</title><content type='html'>One of my favorite quotations from a fictional character comes from “Atlas Shrugged” by Ayn Rand: There is no substitute for competence.&lt;br /&gt;&lt;br /&gt;One of the most important things that we need to do as IT professionals is to use our own experience and competence even when taking advice from peers, or those you deem as experts. Even my own advice is sometimes not correct, when taken out of context (You will note if you follow these blog entries that I will attempt a lot of “tongue-in-cheek” humor, please take it that way).&lt;br /&gt;&lt;br /&gt;As a public speaker (Users Groups, conventions, SQL Saturdays, etc.) I continually try to challenge those attendees at my talks to rethink some of the decisions they’ve made, based upon facts I give them based upon my own experiences. Frequently, they challenge me back (for me, this is part of the fun).&lt;br /&gt;&lt;br /&gt;At a recent talk I gave on indexes, I said something along these lines:&lt;br /&gt;“You may be able to come with some theoretical exceptions to this rule, but from a practical perspective, you should have a clustered index on every table. Without a clustered index, you are creating a hot spot at the tail end of your table’s page chain, (meaning contention when you have multiple insertions, and/or updates which cause rows to remove). In addition, updates which cause rows to move will cause data to be unbalanced towards the tail end of the table’s page chain (as well).”&lt;br /&gt;&lt;br /&gt;A point that has come up (on at least two recent occasions) from an audience member was along the following lines:&lt;br /&gt;“ I was reading a paper by {no idea who wrote the paper, if anybody reading this does, please let me know so that I can credit the author), and in it he/she stated that benchmarking has shown that insertions are fastest with NO clustered index on the table because of some benefits of page allocations …”&lt;br /&gt;&lt;br /&gt;The first time I heard that, I responded that I’d have to read the article to see what it had to say before responding, but that my recommendations from own extensive practical experience stood. The second time I heard that, something clicked, and I responded with, “Was that a single process performing a data load of some sort, or was that a thousand concurrent processes trying to gain access to a table?”&lt;br /&gt;&lt;br /&gt;Context.&lt;br /&gt;&lt;br /&gt;If you are trying to load data into a table, your issue isn’t necessarily contention, it is the speed of your disk &amp;amp; corresponding page allocations. If you are trying to give many users access to the table, your issue is going to be both page and index contention, at update time, page split time, etc.&lt;br /&gt;&lt;br /&gt;Over time, I’m going to be offering a variety of recommendations, every one of which will be based upon my personal experiences in 20 years of tuning SQL Servers.&lt;br /&gt;&lt;br /&gt;Yet, I caution you: everything needs to be taken in context. Test my assertions; make sure that the environments I’m describing actually match your own.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1416983219169300553-2663642831929107735?l=mssqlperformance.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mssqlperformance.blogspot.com/feeds/2663642831929107735/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mssqlperformance.blogspot.com/2009/01/context.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1416983219169300553/posts/default/2663642831929107735'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1416983219169300553/posts/default/2663642831929107735'/><link rel='alternate' type='text/html' href='http://mssqlperformance.blogspot.com/2009/01/context.html' title='Context'/><author><name>Jeff Garbus</name><uri>http://www.blogger.com/profile/09795382811630904379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_CiO9OPlBx6k/SX4dHyMeoiI/AAAAAAAAAAM/Lw3nS23Mpdc/S220/DSC_0243.JPG'/></author><thr:total>1</thr:total></entry></feed>
