<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlblogcasts.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Simons SQL Blog : SQL</title><link>http://sqlblogcasts.com/blogs/simons/archive/tags/SQL/default.aspx</link><description>Tags: SQL</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20917.1142)</generator><item><title>Loads of things going on at #SQLBits</title><link>http://sqlblogcasts.com/blogs/simons/archive/2011/12/17/loads-of-things-going-on-at-sqlbits.aspx</link><pubDate>Sat, 17 Dec 2011 21:30:39 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:16029</guid><dc:creator>simonsabin</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/simons/rsscomments.aspx?PostID=16029</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/simons/commentapi.aspx?PostID=16029</wfw:comment><comments>http://sqlblogcasts.com/blogs/simons/archive/2011/12/17/loads-of-things-going-on-at-sqlbits.aspx#comments</comments><description>Wow its been a busy few weeks in SQLBits land. Session Voting We’ve opened up voting for the sessions for SQLBits 10 http://sqlbits.com/information/PublicSessions.aspx Make sure you vote so we pick the sessions you want. You’ve got to register on the...(&lt;a href="http://sqlblogcasts.com/blogs/simons/archive/2011/12/17/loads-of-things-going-on-at-sqlbits.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=16029" width="1" height="1"&gt;</description><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/SQL/default.aspx">SQL</category><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/SQLBits/default.aspx">SQLBits</category></item><item><title>SQLBits evening do</title><link>http://sqlblogcasts.com/blogs/simons/archive/2008/09/02/SQLBits-evening-do.aspx</link><pubDate>Tue, 02 Sep 2008 11:36:25 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:10768</guid><dc:creator>simonsabin</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/simons/rsscomments.aspx?PostID=10768</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/simons/commentapi.aspx?PostID=10768</wfw:comment><comments>http://sqlblogcasts.com/blogs/simons/archive/2008/09/02/SQLBits-evening-do.aspx#comments</comments><description>
&lt;p&gt;We have finally got finalised that, at SQLBits, we will 
be having a drinks reception after the sessions finish.&lt;/p&gt;
&lt;p&gt;There will FREE beer (other drinks will be available) and&amp;nbsp;pizza.&lt;/p&gt;
&lt;p&gt;We&amp;#39;ve also got some entertainment planned so it should be a good 
evening&lt;/p&gt;
&lt;br /&gt;
&lt;script type="text/javascript" src="http://sqlblogcasts.com/sitefiles/1000/Social_Buttons.js"&gt;&lt;/script&gt;
&lt;hr /&gt;
-
&lt;script type="text/javascript" src="http://sqlblogcasts.com/sitefiles/1000/google_rss.js"&gt;
&lt;/script&gt;
&lt;script type="text/javascript"&gt;var height=90;var width=720;&lt;/script&gt;
&lt;script src="http://www.sqlknowhow.com/scripts/Banner.js" type="text/javascript"&gt;
&lt;/script&gt;
 &lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=10768" width="1" height="1"&gt;</description><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/SQL/default.aspx">SQL</category><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/Community/default.aspx">Community</category><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/Usergroup/default.aspx">Usergroup</category></item><item><title>To cluster of not</title><link>http://sqlblogcasts.com/blogs/simons/archive/2007/06/26/To-cluster-of-not.aspx</link><pubDate>Tue, 26 Jun 2007 12:51:26 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:1930</guid><dc:creator>simonsabin</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/simons/rsscomments.aspx?PostID=1930</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/simons/commentapi.aspx?PostID=1930</wfw:comment><comments>http://sqlblogcasts.com/blogs/simons/archive/2007/06/26/To-cluster-of-not.aspx#comments</comments><description>
&lt;p&gt;Tony&amp;#39;s blogged about the use of heaps &lt;a href="http://sqlblogcasts.com/blogs/tonyrogerson/archive/2007/06/24/row-fragmentation-hopscotch-heap-v-clustered-and-io-cost.aspx"&gt;http://sqlblogcasts.com/blogs/tonyrogerson/archive/2007/06/24/row-fragmentation-hopscotch-heap-v-clustered-and-io-cost.aspx&lt;/a&gt;. 
Whilst this highlights data on a page being out of sequence and thus yoyoing 
when you scan&amp;nbsp;the data, it doesn&amp;#39;t mean you should always have a clustered 
index.&lt;/p&gt;
&lt;p&gt;The stats in Tony&amp;#39;s blog are&amp;nbsp;only because the query is a full table scan 
in the first (heap) query. With a clustered index you are not doing a table scan 
your are only doing a partial scan and so the reads are different. If you remove 
the where clause thus forcing a table scan then the heap is qucker because it is 
more compact, it has to read less pages.&lt;/p&gt;
&lt;p&gt;You can also address these issues with a covering index. An non clustered 
index is effectively the its own special table with a clustered index with the 
leaf pages also containing the Row id or Primary key column.&lt;/p&gt;
&lt;p&gt;Also the issue here is highlighted by a scan. If you are performing an 
operation that does a seek heaps aren&amp;#39;t bad. Also clustered indexes result in 
the whole row being read, thus if you only need a few rows they can also be 
worse than a heap with a covering index.&lt;/p&gt;
&lt;p&gt;Finally having a clustered index is beneficial if you key size is &amp;lt; 8 
bytes because the key is put in the leaf of non-clustered indexes. Whereas a 
heap the row id is and the row id is 8 bytes&lt;/p&gt;
&lt;p&gt;Finally with clustered indexes you will end up with page splits, this can 
result in page fragmentation across the database file, the worst case would be 
that in order to read 8 pages (8k),&amp;nbsp;8 extents(64k) would have to be read 
because each page is on a different extent. The ALTER INDEX REORGANISE and 
REBUILD address this fragmentation by the former&amp;nbsp;moving pages to be in the 
same order on disk as logically and also compacting pages in and the latter 
rebuilding the index entirely. REORGANISE is an online operation.&lt;/p&gt;
&lt;p&gt;Following this post Tony and I have had a very long discussion. The bottom 
line is that if there is one thing you should learn its the internals of 
indexes.&amp;nbsp;This would be my starter,&amp;nbsp;heaps and b trees, covering 
indexes, bookmark lookups, included columns, page fragmentation, page splitting 
...&lt;/p&gt;
&lt;br /&gt;
&lt;script type="text/javascript" src="http://sqlblogcasts.com/sitefiles/1000/Social_Buttons.js"&gt;&lt;/script&gt;
&lt;hr /&gt;
-
&lt;script type="text/javascript" src="http://sqlblogcasts.com/sitefiles/1000/google_rss.js"&gt;
&lt;/script&gt;
&lt;script type="text/javascript"&gt;var height=90;var width=720;&lt;/script&gt;
&lt;script src="http://www.sqlknowhow.com/scripts/Banner.js" type="text/javascript"&gt;
&lt;/script&gt;
 &lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=1930" width="1" height="1"&gt;</description><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/SQL/default.aspx">SQL</category><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/Performance/default.aspx">Performance</category><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/Tips+and+Tricks/default.aspx">Tips and Tricks</category><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/SQL+Engine/default.aspx">SQL Engine</category></item><item><title>ProClarity 6.3 available on MSDN downloads</title><link>http://sqlblogcasts.com/blogs/simons/archive/2007/04/04/ProClarity-6-3-available-on-MSDN-downloads.aspx</link><pubDate>Wed, 04 Apr 2007 22:28:43 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:1708</guid><dc:creator>simonsabin</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/simons/rsscomments.aspx?PostID=1708</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/simons/commentapi.aspx?PostID=1708</wfw:comment><comments>http://sqlblogcasts.com/blogs/simons/archive/2007/04/04/ProClarity-6-3-available-on-MSDN-downloads.aspx#comments</comments><description>
&lt;p&gt;I&amp;#39;ve just logged into MSDN downloads and was very 
shocked to see ProClarity available for download.&lt;/p&gt;
&lt;p&gt;Both server and desktop versions are available. &lt;/p&gt;
&lt;p&gt;You can read more on Proclarity here &lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.proclarity.com/"&gt;http://www.proclarity.com/&lt;/a&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;script type="text/javascript" src="http://sqlblogcasts.com/sitefiles/1000/Social_Buttons.js"&gt;&lt;/script&gt;
&lt;hr /&gt;
-
&lt;script type="text/javascript" src="http://sqlblogcasts.com/sitefiles/1000/google_rss.js"&gt;
&lt;/script&gt;
&lt;script type="text/javascript"&gt;var height=90;var width=720;&lt;/script&gt;
&lt;script src="http://www.sqlknowhow.com/scripts/Banner.js" type="text/javascript"&gt;
&lt;/script&gt;
 &lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=1708" width="1" height="1"&gt;</description><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/SQL/default.aspx">SQL</category><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/Reporting/default.aspx">Reporting</category></item><item><title>Two Free MSDN Team Suite Subscriptions</title><link>http://sqlblogcasts.com/blogs/simons/archive/2006/11/12/Two-Free-MSDN-Team-Suite-Subscriptions.aspx</link><pubDate>Sun, 12 Nov 2006 23:52:54 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:1290</guid><dc:creator>simonsabin</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/simons/rsscomments.aspx?PostID=1290</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/simons/commentapi.aspx?PostID=1290</wfw:comment><comments>http://sqlblogcasts.com/blogs/simons/archive/2006/11/12/Two-Free-MSDN-Team-Suite-Subscriptions.aspx#comments</comments><description>&lt;p&gt;&lt;span&gt;If you want to win one of two MSDN Team Suite Subscriptions worth in excess of £5,000 then its simple. Start contributing the SQL Blog sitte sqlblogcasts.com and you&amp;#39;ll be in with a chance. Its free to join up and start blogging so whats stopping you.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;To learn more read Tony&amp;#39;s blog. &lt;a href="http://sqlblogcasts.com/blogs/tonyrogerson/archive/2006/11/11/1285.aspx"&gt;Free MSDN Subscriptions just to start blogging&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;
&lt;script type="text/javascript" src="http://sqlblogcasts.com/sitefiles/1000/Social_Buttons.js"&gt;&lt;/script&gt;
&lt;hr /&gt;
-
&lt;script type="text/javascript" src="http://sqlblogcasts.com/sitefiles/1000/google_rss.js"&gt;
&lt;/script&gt;
&lt;script type="text/javascript"&gt;var height=90;var width=720;&lt;/script&gt;
&lt;script src="http://www.sqlknowhow.com/scripts/Banner.js" type="text/javascript"&gt;
&lt;/script&gt;
 &lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=1290" width="1" height="1"&gt;</description><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/SQL/default.aspx">SQL</category><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/SQL+Server+2005/default.aspx">SQL Server 2005</category><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/Free/default.aspx">Free</category></item><item><title>Native Command Substitution is not supported</title><link>http://sqlblogcasts.com/blogs/simons/archive/2006/10/05/Native-Command-Substitution-is-not-supported.aspx</link><pubDate>Thu, 05 Oct 2006 14:29:08 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:1175</guid><dc:creator>simonsabin</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/simons/rsscomments.aspx?PostID=1175</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/simons/commentapi.aspx?PostID=1175</wfw:comment><comments>http://sqlblogcasts.com/blogs/simons/archive/2006/10/05/Native-Command-Substitution-is-not-supported.aspx#comments</comments><description>&lt;p&gt;In response to a recent support incident we raised we got a response about use of detours in SQL Server.&lt;/p&gt;
&lt;p&gt;A detour is a means by which you can change what SQL Server does. This is used by Litespeed to change native backup commands into Litespeed backup commands. Whilst I always thought this a neat idea I always felt it a bit risky. If I want to do a litespeed backup I can easily write the code or use the UI to do so.&lt;/p&gt;
&lt;p&gt;So it seems my caution has proved correct. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://support.microsoft.com/kb/920925/en-us"&gt;Use of detours by a third-party solution is not supported with SQL Server&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;
&lt;script type="text/javascript" src="http://sqlblogcasts.com/sitefiles/1000/Social_Buttons.js"&gt;&lt;/script&gt;
&lt;hr /&gt;
-
&lt;script type="text/javascript" src="http://sqlblogcasts.com/sitefiles/1000/google_rss.js"&gt;
&lt;/script&gt;
&lt;script type="text/javascript"&gt;var height=90;var width=720;&lt;/script&gt;
&lt;script src="http://www.sqlknowhow.com/scripts/Banner.js" type="text/javascript"&gt;
&lt;/script&gt;
 &lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=1175" width="1" height="1"&gt;</description><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/SQL/default.aspx">SQL</category><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/SQL+Server+2005/default.aspx">SQL Server 2005</category><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/Tips+and+Tricks/default.aspx">Tips and Tricks</category><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/Availability/default.aspx">Availability</category><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/Backup+and+Recovery/default.aspx">Backup and Recovery</category><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/Operations/default.aspx">Operations</category></item><item><title>Is IDENT_CURRENT the next @@identity</title><link>http://sqlblogcasts.com/blogs/simons/archive/2006/07/11/Is-IDENT_5F00_CURRENT-the-next-_40004000_identity.aspx</link><pubDate>Tue, 11 Jul 2006 19:15:44 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:882</guid><dc:creator>simonsabin</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/simons/rsscomments.aspx?PostID=882</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/simons/commentapi.aspx?PostID=882</wfw:comment><comments>http://sqlblogcasts.com/blogs/simons/archive/2006/07/11/Is-IDENT_5F00_CURRENT-the-next-_40004000_identity.aspx#comments</comments><description>&lt;P&gt;I've just finished watching the webcast on building a wareshouse according to Kimball principles. In it they generate an audit record by inserting a record and then using IDENT_CURRENT to get the identity value. &lt;/P&gt;
&lt;P&gt;A few months ago some one on the forums was screaming because the IDENT_CURRENT was not working on a 64 bit server it was returning NULL.&lt;/P&gt;
&lt;P&gt;My point is they both wanted the last identity generated for a table, but both missed the point that IDENT_CURRENT is not specific to a&amp;nbsp;session but is server wide. This means you could be getting the identity value generated for an insert in another session. Pretty much like calling select MAX(identityCol) from table (but without the locking).&lt;/P&gt;
&lt;P&gt;So just as people with triggers got burnt with the use of @@identity so are people with IDENT_CURRENT() whats more it probably won't show up as a real problem i.e. a failure, you will just have records associated with the wrong parent, your database will slowly become corrupt.&lt;/P&gt;
&lt;P&gt;In both of these situations the user should be using SCOPE_IDENTITY to get the value generated by their last insert statement.&lt;/P&gt;&lt;BR&gt;
&lt;SCRIPT type=text/javascript&gt;
google_ad_client = "pub-9351707026400773";
google_ad_width = 468;
google_ad_height = 15;
google_ad_format = "468x15_0ads_al_s";
google_ad_channel ="4086479631";
&lt;/SCRIPT&gt;

&lt;SCRIPT src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type=text/javascript&gt;
&lt;/SCRIPT&gt;-
&lt;SCRIPT type=text/javascript&gt;
google_ad_client = "pub-9351707026400773";
google_alternate_color="FFDDAA";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
google_ad_channel ="7806183107";
&lt;/SCRIPT&gt;

&lt;SCRIPT src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type=text/javascript&gt;
&lt;/SCRIPT&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=882" width="1" height="1"&gt;</description><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/SQL/default.aspx">SQL</category><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/SQL+Server+2005/default.aspx">SQL Server 2005</category><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/TSQL/default.aspx">TSQL</category></item><item><title>A large slice of humble pie please Mr Thomson</title><link>http://sqlblogcasts.com/blogs/simons/archive/2006/06/23/A-large-slice-of-humble-pie-please-Mr-Thomson.aspx</link><pubDate>Fri, 23 Jun 2006 09:11:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:844</guid><dc:creator>simonsabin</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/simons/rsscomments.aspx?PostID=844</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/simons/commentapi.aspx?PostID=844</wfw:comment><comments>http://sqlblogcasts.com/blogs/simons/archive/2006/06/23/A-large-slice-of-humble-pie-please-Mr-Thomson.aspx#comments</comments><description>&lt;P&gt;In my presentation last night I went through a process by which you can create Raw files so that you can append to them in a for each loop as there is no "Create once for the package" setting for a Raw file. I knew Jamie had covered &lt;A href="http://blogs.conchango.com/jamiethomson/archive/2005/12/01/2443.aspx"&gt;this in his blog&lt;/A&gt; but I was doing a slightly different approach and Jamie raised this in the presentation. As I hadn't read his post properly I dismissed his comments as a heckler from the front row. Well I guess I will be eating humble pie for a while, as Jamie did, when I got home I tested what Jamie had proposed and it worked. &lt;/P&gt;
&lt;P&gt;Simply put, the "Append" option will create the file if it doesn't exist. If you need to use the Raw file eslewhere in your package then you will have to create the raw file so that SSIS can determine the columns that will be in the Raw file and as Jamie pointed out this does only need to be done at design time. Jamie has explained with &lt;A href="http://blogs.conchango.com/jamiethomson/archive/2006/06/22/4116.aspx"&gt;pictures here&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Whilst my solution creates an empty file every time the package runs, with Jamie's solution you need to make sure that your package deletes any raw files that already exist.&lt;/P&gt;
&lt;P&gt;As for the presentation it went ok towards the end, as Jamie put it "...He comes across as being utterly unprepared..." which was very true for the start. I made the fundamental mistake of moving everything to a machine the night before which screwed everything up. Lesson learnt.&lt;/P&gt;&lt;BR&gt;
&lt;SCRIPT type=text/javascript&gt;
google_ad_client = "pub-9351707026400773";
google_ad_width = 468;
google_ad_height = 15;
google_ad_format = "468x15_0ads_al_s";
google_ad_channel ="4086479631";
&lt;/SCRIPT&gt;

&lt;SCRIPT src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type=text/javascript&gt;
&lt;/SCRIPT&gt;-
&lt;SCRIPT type=text/javascript&gt;
google_ad_client = "pub-9351707026400773";
google_alternate_color="FFDDAA";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
google_ad_channel ="7806183107";
&lt;/SCRIPT&gt;

&lt;SCRIPT src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type=text/javascript&gt;
&lt;/SCRIPT&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=844" width="1" height="1"&gt;</description><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/SQL/default.aspx">SQL</category><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/SQL+Server+2005/default.aspx">SQL Server 2005</category></item><item><title>Are you allowed to be sizeist in the database world</title><link>http://sqlblogcasts.com/blogs/simons/archive/2006/05/25/Are-you-allowed-to-be-sizeist-in-the-database-world.aspx</link><pubDate>Thu, 25 May 2006 16:33:21 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:760</guid><dc:creator>simonsabin</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/simons/rsscomments.aspx?PostID=760</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/simons/commentapi.aspx?PostID=760</wfw:comment><comments>http://sqlblogcasts.com/blogs/simons/archive/2006/05/25/Are-you-allowed-to-be-sizeist-in-the-database-world.aspx#comments</comments><description>&lt;P&gt;Well even if your not, one of my real bug bears is fat tables. These aren't large tables they are fat tables, wide ones with lots of columns or large data types.&lt;/P&gt;
&lt;P&gt;The reason this gets is is people develop databases with 10s of rows in them. Then&amp;nbsp;end up with millions of rows in them in a live environment and find this things just don't perform.&lt;/P&gt;
&lt;P&gt;Then managing those tables is a real chore.&lt;/P&gt;
&lt;P&gt;Just because you have a table called person doesn't mean all the information relating to a person has to be in that table. Especially when you most of the time all you want is there name. Ok so you can create covering indexes, but then you hurt your insert performance and you can't create a covering index for every situation. &lt;/P&gt;
&lt;P&gt;Imageine the situation you have a table that links people to stadium. you can have millions of people visit your stadium but you've only got a few stadium,&lt;/P&gt;
&lt;P&gt;Do you have a table that is&amp;nbsp;like this&lt;/P&gt;
&lt;P&gt;create table StadiumVisit (personId uniqueidentifier not null &lt;BR&gt;, visitDate datetime not null &lt;BR&gt;, stadium int not null&lt;BR&gt;, comments varchar(200)) &lt;/P&gt;
&lt;P&gt;create table StadiumVisit2 (personId int not null &lt;BR&gt;, visitDate smalldatetime not null &lt;BR&gt;, stadium tinyint not null) &lt;/P&gt;
&lt;P&gt;Whats the different well the first would be ~a minium of &amp;nbsp;28 bytes per row and the other would be 9 bytes per row (ignoring overhead). With 10 million rows the second takes up 90Mb. Assuming the average comment was 100 bytes the first would take 1280Mb ~1.2Gb&lt;/P&gt;
&lt;P&gt;How much memory you got in your box? 1Gb which one is going to perform better?&lt;/P&gt;
&lt;P&gt;Even ignoring the comments field thats 3 times more data to read to process a query, the impact is that you put more pages into memory that you don't need, you push pages out of memory that are needed by other processes, you query needs to process more data and thus use more cpu. In a scalable system make sure you do as little as possible, this means it has less impact on anything else and so you server can do more. &lt;/P&gt;
&lt;P&gt;For a great book on this look at &lt;A href="http://www.amazon.com/exec/obidos/redirect?link_code=ur2&amp;amp;tag=simonsblog-20&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;path=http%3A%2F%2Fwww.amazon.com%2Fgp%2Fproduct%2F1590595297"&gt;Pro SQL Server 2005 Database Design and Optimization&lt;/A&gt;&lt;IMG style="BORDER-RIGHT:medium none;BORDER-TOP:medium none;MARGIN:0px;BORDER-LEFT:medium none;BORDER-BOTTOM:medium none;" height=1 alt="" src="http://www.assoc-amazon.com/e/ir?t=simonsblog-20&amp;amp;l=ur2&amp;amp;o=1" width=1 border=0&gt;&amp;nbsp;by Louis Davidson. &lt;/P&gt;
&lt;P&gt;But be careful of fat tables, we all no how they get fat but I will leave that to another time.&lt;/P&gt;-
&lt;SCRIPT type=text/javascript&gt;
google_ad_client = "pub-9351707026400773";
google_alternate_color="FFDDAA";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
google_ad_channel ="7806183107";
&lt;/SCRIPT&gt;

&lt;SCRIPT src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type=text/javascript&gt;
&lt;/SCRIPT&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=760" width="1" height="1"&gt;</description><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/SQL/default.aspx">SQL</category><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/SQL+Server+2005/default.aspx">SQL Server 2005</category><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/Performance/default.aspx">Performance</category><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/TSQL/default.aspx">TSQL</category></item><item><title>Performance of MAX trick</title><link>http://sqlblogcasts.com/blogs/simons/archive/2006/05/16/Performance-of-MAX-trick.aspx</link><pubDate>Tue, 16 May 2006 07:15:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:469</guid><dc:creator>simonsabin</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/simons/rsscomments.aspx?PostID=469</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/simons/commentapi.aspx?PostID=469</wfw:comment><comments>http://sqlblogcasts.com/blogs/simons/archive/2006/05/16/Performance-of-MAX-trick.aspx#comments</comments><description>&lt;P&gt;Jamie posted a comment to by post about the trick for finding a maximum value in a set of results. Stating that the CASE statement solution was significantly faster. Being a synic I didn't believe him so tried it out for myself&lt;/P&gt;
&lt;P&gt;The following are the two sets of code, and below that is a script to populate the tables, the first set of inserts are there to test the results, the commented out section is to load the dates table with lots of values.&lt;/P&gt;
&lt;P&gt;On my server the&amp;nbsp;difference is&amp;nbsp;negligible, &amp;nbsp;often with the subquery mechanism being quicker to execute, if slghtly longer to compile.&lt;/P&gt;
&lt;P&gt;However the point to note is that the compile time is ~1ms and the execution time for 1024 rows is ~70ms. Thats pretty quick which ever option you choose and more importantly I know which one I would want to be supporting :)&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;select case when orderdate &amp;gt; canceldate then &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case when shipdate &amp;gt; deliverydate then &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case when orderdate &amp;gt; shipdate&amp;nbsp; then orderdate else shipdate end&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case when orderdate &amp;gt; deliverydate&amp;nbsp; then orderdate else deliverydate end&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case when shipdate &amp;gt; deliverydate then &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case when canceldate &amp;gt; shipdate&amp;nbsp; then canceldate else shipdate end&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case when canceldate &amp;gt; deliverydate&amp;nbsp; then canceldate else deliverydate end&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end&lt;BR&gt;, *&lt;BR&gt;from dates&lt;BR&gt;go&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;FONT face="Courier New" size=2&gt;select (select max(datevalue) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from (select orderdate datevalue union all select canceldate union all select shipdate union all select deliverydate )d)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , *&lt;BR&gt;from dates&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;create table dates (orderdate datetime, canceldate datetime,shipdate datetime, deliverydate datetime)&lt;BR&gt;go&lt;BR&gt;insert into dates values ('1/1/2005', '1/2/2005', '1/3/2005', '1/4/2005')&lt;BR&gt;insert into dates values ('1/1/2005', '1/2/2005', '1/4/2005', '1/3/2005')&lt;BR&gt;insert into dates values ('1/1/2005', '1/3/2005', '1/2/2005', '1/4/2005')&lt;BR&gt;insert into dates values ('1/1/2005', '1/3/2005', '1/4/2005', '1/2/2005')&lt;BR&gt;insert into dates values ('1/1/2005', '1/4/2005', '1/2/2005', '1/3/2005')&lt;BR&gt;insert into dates values ('1/1/2005', '1/4/2005', '1/3/2005', '1/2/2005')&lt;BR&gt;insert into dates values ('1/2/2005', '1/1/2005', '1/3/2005', '1/4/2005')&lt;BR&gt;insert into dates values ('1/2/2005', '1/1/2005', '1/4/2005', '1/3/2005')&lt;BR&gt;insert into dates values ('1/2/2005', '1/3/2005', '1/1/2005', '1/4/2005')&lt;BR&gt;insert into dates values ('1/2/2005', '1/3/2005', '1/4/2005', '1/2/2005')&lt;BR&gt;insert into dates values ('1/2/2005', '1/4/2005', '1/1/2005', '1/3/2005')&lt;BR&gt;insert into dates values ('1/2/2005', '1/4/2005', '1/3/2005', '1/1/2005')&lt;BR&gt;insert into dates values ('1/3/2005', '1/2/2005', '1/1/2005', '1/4/2005')&lt;BR&gt;insert into dates values ('1/3/2005', '1/2/2005', '1/4/2005', '1/1/2005')&lt;BR&gt;insert into dates values ('1/3/2005', '1/1/2005', '1/2/2005', '1/4/2005')&lt;BR&gt;insert into dates values ('1/3/2005', '1/1/2005', '1/4/2005', '1/2/2005')&lt;BR&gt;insert into dates values ('1/3/2005', '1/4/2005', '1/2/2005', '1/1/2005')&lt;BR&gt;insert into dates values ('1/3/2005', '1/4/2005', '1/1/2005', '1/2/2005')&lt;BR&gt;insert into dates values ('1/4/2005', '1/2/2005', '1/3/2005', '1/1/2005')&lt;BR&gt;insert into dates values ('1/4/2005', '1/2/2005', '1/1/2005', '1/3/2005')&lt;BR&gt;insert into dates values ('1/4/2005', '1/3/2005', '1/2/2005', '1/1/2005')&lt;BR&gt;insert into dates values ('1/4/2005', '1/3/2005', '1/1/2005', '1/2/2005')&lt;BR&gt;insert into dates values ('1/4/2005', '1/1/2005', '1/2/2005', '1/3/2005')&lt;BR&gt;insert into dates values ('1/4/2005', '1/1/2005', '1/3/2005', '1/2/2005')&lt;BR&gt;go&lt;BR&gt;--insert into dates select getdate() + 100*rand(),getdate() + 100*rand(),getdate() + 100*rand(),getdate() + 100*rand()&lt;BR&gt;--go 1000&lt;BR&gt;set statistics time on&lt;BR&gt;go&lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;-
&lt;SCRIPT type=text/javascript&gt;
google_ad_client = "pub-9351707026400773";
google_alternate_color="FFDDAA";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
google_ad_channel ="7806183107";
&lt;/SCRIPT&gt;

&lt;SCRIPT src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type=text/javascript&gt;
&lt;/SCRIPT&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=469" width="1" height="1"&gt;</description><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/SQL/default.aspx">SQL</category><category domain="http://sqlblogcasts.com/blogs/simons/archive/tags/Performance/default.aspx">Performance</category></item></channel></rss>