{"id":658,"date":"2005-09-23T04:40:00","date_gmt":"2005-09-23T04:40:00","guid":{"rendered":"\/blogs\/kimberly\/post\/MSDN-Webcast-QA-A-Primer-to-Proper-SQL-Server-Development-Part-6-of-10.aspx"},"modified":"2013-01-11T23:12:44","modified_gmt":"2013-01-12T07:12:44","slug":"msdn-webcast-qa-a-primer-to-proper-sql-server-development-part-6-of-10","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/kimberly\/msdn-webcast-qa-a-primer-to-proper-sql-server-development-part-6-of-10\/","title":{"rendered":"MSDN Webcast Q&#038;A: A Primer to Proper SQL Server Development, Part 6 of 10"},"content":{"rendered":"<p>\n<span><font face=\"Verdana\"><strong><font size=\"4\"><font color=\"#000080\">Effectively Designing a Scalable and Reliable Database<\/strong><\/span>\n<\/p>\n<p>\n<span><font face=\"Verdana\"><font color=\"#000080\"><strong><font face=\"Verdana\"><em><span>A Primer to Proper SQL Server Development<\/span><\/em><\/strong><\/span>\n<\/p>\n<p>\n<span><font face=\"Verdana\"><font color=\"#000080\"><strong><font face=\"Verdana\"><span>SQL Server Mixed Workloads, Secondary Databases, Locking and Isolation, Part&nbsp;6 of 10<\/span><\/strong><\/span>\n<\/p>\n<p>\n<span><font face=\"Verdana\"><font color=\"#000080\"><strong><font face=\"Verdana\"><span><\/span><\/strong><font color=\"#000080\"><strong><font face=\"Verdana\"><em><span>Presented by<\/span><\/em><span> Kimberly L. Tripp, SQLskills.com<\/span><\/strong><\/span>\n<\/p>\n<p><span><font face=\"Verdana\"><font color=\"#000080\"><strong><font face=\"Verdana\"><span><\/span><\/strong><span><font color=\"#000000\"><strong>Q: Can I view a recording of this webcast?<\/strong><\/span><span><font color=\"#000000\"><span><font color=\"#000000\">Part&nbsp;6 can be replayed by clicking <a href=\"https:\/\/msevents.microsoft.com\/cui\/Error.aspx?culture=en-US&amp;ErrorMsgID=ErrorMessage.EventDoesNotExist&amp;EventID=\"><strong><span>here<\/span><\/strong><\/a>.<\/span><\/span><\/span><span><font face=\"Verdana\"><span><font color=\"#000000\"> <\/p>\n<p>\n<span><strong>Q: Where can we get the demo scripts AND the sample database: Credit? <\/strong><\/span><span style=\"font-size: 11pt; color: black\">The demo scripts are in this zip (<a href=\"https:\/\/www.sqlskills.com\/blogs\/kimberly\/content\/binary\/20050916msdndemoscripts.zip\">20050916MSDNDemoScripts.zip (6.11 KB)<\/a>); here in this blog entry. However, at the series completion, I will also create an entry under <a href=\"\/blogs\/kimberly\/ct.ashx?id=2b08c79e-d180-4ff6-96b0-f29896411bab&amp;url=http%3a\/\/3.209.169.194\/blogs\/kimberly\/ct.ashx%3fid%3d1de5cfcc-493d-4874-aed4-7fb330f9eaf7%26url%3dhttp%253a%252f%252fwww.sqlskills.com%252fblogs%252fkimberly%252fct.ashx%253fid%253de46e2290-3c12-4723-b2cd-b16c54afd36b%2526url%253dhttp%25253a%25252f%25252fwww.sqlskills.com%25252fpastConferences.asp\" class=\"broken_link\"><span>Past Event Resources<\/span><\/a> for the entire webcast series. <\/span><span>&nbsp;<\/span><span style=\"font-size: 11pt; color: black\">To download the ZIP of the Credit Database Backup click <a href=\"\/blogs\/kimberly\/ct.ashx?id=2b08c79e-d180-4ff6-96b0-f29896411bab&amp;url=http%3a\/\/https:\/\/www.sqlskills.com\/resources\/conferences\/CreditBackup80.zip\"><font size=\"2\" color=\"#696969\">here<\/a>. Once unzipped, restore this backup to SQL Server 2000 or SQL Server 2005. The backup is a SQL Server 2000 backup and can be restored to either version! If restoring to SQL Server 2005, you might want to change the destination for the data and log file as the path will probably be different.<\/span>\n<\/p>\n<p><\/span><\/span><\/p>\n<p>\n<span style=\"font-size: 11pt; color: black\"><\/span><span><strong>Q: Where are the links to all prior Webcast Q&amp;As from this series?<\/strong><\/span>\n<\/p>\n<blockquote dir=\"ltr\" style=\"margin-right: 0px\">\n<p>\n\t<span>Part 1: <strong>Creating a Recoverable Database<br \/>\n\t<\/strong><\/span><span style=\"font-size: 11pt; color: black\">For the MSDN Download for Part 1, click <a href=\"https:\/\/msevents.microsoft.com\/cui\/Error.aspx?culture=en-US&amp;ErrorMsgID=ErrorMessage.EventDoesNotExist&amp;EventID=\"><span><strong>here<\/strong><\/span><\/a>.<br \/>\n\t<\/span><span style=\"font-size: 11pt; color: black\">For the SQLskills Blog Entry for Part 1, click <a href=\"https:\/\/www.sqlskills.com\/blogs\/kimberly\/msdn-webcast-qa-a-primer-to-proper-sql-server-development-part-1-of-10\/\"><span><strong>here<\/strong><\/span><\/a>.<\/span>\n\t<\/p>\n<p>\n\t<span style=\"font-size: 11pt; color: black\"><\/span><span>Part 2: <strong>Creating a Reliable and Automated Backup Strategy<\/strong><br \/>\n\t<\/span><span style=\"font-size: 11pt; color: black\">For the MSDN Download for Part 2, click <a href=\"https:\/\/msevents.microsoft.com\/cui\/Error.aspx?culture=en-US&amp;ErrorMsgID=ErrorMessage.EventDoesNotExist&amp;EventID=\"><span><strong>here<\/strong><\/span><\/a>.<br \/>\n\t<\/span><span style=\"font-size: 11pt; color: black\">For the SQLskills Blog Entry for Part 2, click <a href=\"https:\/\/www.sqlskills.com\/blogs\/kimberly\/msdn-webcast-qa-a-primer-to-proper-sql-server-development-part-2-of-10\/\"><span><strong>here<\/strong><\/span><\/a>.<\/span>\n\t<\/p>\n<p>\n\t<span style=\"font-size: 11pt; color: black\"><\/span><span>Part 3: <strong>Designing Tables that Scale, Best Practices in Data Types and Initial Table Structures<\/strong><br \/>\n\t<\/span><span style=\"font-size: 11pt; color: black\">For the MSDN Download for Part 3, click <a href=\"https:\/\/msevents.microsoft.com\/cui\/Error.aspx?culture=en-US&amp;ErrorMsgID=ErrorMessage.EventDoesNotExist&amp;EventID=\"><span><strong>here<\/strong><\/span><\/a>.<br \/>\n\t<\/span><span style=\"font-size: 11pt; color: black\">For the SQLskills Blog Entry for Part 3, click <a href=\"https:\/\/www.sqlskills.com\/blogs\/kimberly\/msdn-webcast-qa-a-primer-to-proper-sql-server-development-part-3-of-10\/\"><span><strong>here<\/strong><\/span><\/a>.<\/span>\n\t<\/p>\n<p>\n\t<span style=\"font-size: 11pt; color: black\"><\/span><span style=\"font-size: 11pt; color: black\"><span>Part 4: <strong>SQL Server Indexing Best Practices<br \/>\n\t<\/strong><\/span><span style=\"font-size: 11pt; color: black\">For the MSDN Download for Part 4, click <a href=\"https:\/\/msevents.microsoft.com\/cui\/Error.aspx?culture=en-US&amp;ErrorMsgID=ErrorMessage.EventDoesNotExist&amp;EventID=\"><span><strong>here<\/strong><\/span><\/a>.<br \/>\n\t<\/span><span>For the SQLskills Blog Entries for Part 4<br \/>\n\t<\/span><span style=\"font-size: 11pt; color: black\">Resource links blog entry, click <a href=\"https:\/\/www.sqlskills.com\/blogs\/kimberly\/msdn-webcast-qa-for-resources-indexing-best-practices-part-4-of-10\/\"><span><strong>here<\/strong><\/span><\/a>.<br \/>\n\t<\/span><span style=\"font-size: 11pt; color: black\"><span style=\"font-size: 11pt; color: black\">Q&amp;A blog entry, click <a href=\"https:\/\/www.sqlskills.com\/blogs\/kimberly\/msdn-webcast-qa-a-primer-to-proper-sql-server-development-part-4-of-10\/\"><span><strong>here<\/strong><\/span><\/a>.<\/span><\/span><\/span>\n\t<\/p>\n<p>\n\t<span style=\"font-size: 11pt; color: black\"><span style=\"font-size: 11pt; color: black\"><span style=\"font-size: 11pt; color: black\"><\/span><\/span><\/span><span style=\"font-size: 11pt; color: black\"><span style=\"font-size: 11pt; color: black\"><span>Part 5: <strong>SQL Server Index Defrag Best Practices<br \/>\n\t<\/strong><\/span><\/span><span><span>For the MSDN Download for Part 5, click <a href=\"https:\/\/msevents.microsoft.com\/cui\/Error.aspx?culture=en-US&amp;ErrorMsgID=ErrorMessage.EventDoesNotExist&amp;EventID=\"><strong><span>here<\/span><\/strong><\/a>.<br \/>\n\t<\/span><\/span><span><span>For the SQLskills Blog <\/span><span><span>entry, click <a href=\"https:\/\/www.sqlskills.com\/blogs\/kimberly\/msdn-webcast-qa-a-primer-to-proper-sql-server-development-part-5-of-10\/\"><strong><span>here<\/span><\/strong><\/a>.<\/span><\/span><\/span> <\/span>\n\t<\/p>\n<\/blockquote>\n<p>\n<span><strong>Q: How can I replay previous sessions? I thought we were going to get emails for replaying &#8212; but I haven&#39;t received any replay emails.<\/strong><\/span> <span>You will receive replay emails ONLY when you register for these sessions through MSDN. We&rsquo;ve come to find out that there are other ways to register but it&rsquo;s only through MSDN that we know for sure you will receive the replay information. <\/span>\n<\/p>\n<p>\n<span><\/span><span><strong>Technical Questions<\/strong><\/span>\n<\/p>\n<p>\n<span style=\"font-size: 11pt; color: black\"><strong><span>Q: I know you have covered indexes and backups in other webcasts, but here is my question I use heavily temporary tables. My TempDB grows up to 5 GIG. Should I backup or truncate the transaction log in order to bring it back to its normal size? <\/span><\/strong><span style=\"font-size: 10pt; font-family: Verdana\">No, there is no need to specifically maintain the transaction log of the TempDB database. If the transaction log (and subsequently, the database) grows large &ndash; there could be multiple reasons for that and instead of thinking in terms of trying to manage the log, I&rsquo;d look at long running transactions and\/or large transaction. You can use Profiler to help you see long running and\/or large transactions.<\/span><\/span>\n<\/p>\n<p>\n<span style=\"font-size: 11pt; color: black\"><span style=\"font-size: 10pt; font-family: Verdana\"><\/span><strong><span>Q: Can I perform a database snapshot to another server? <\/span><\/strong><span style=\"font-size: 10pt; font-family: Verdana\">No, database snapshots must be created on the same server as the database on which the snapshot is being based.<\/span><\/span>\n<\/p>\n<p>\n<span style=\"font-size: 11pt; color: black\"><span style=\"font-size: 10pt; font-family: Verdana\"><\/span><strong><span>Q: Can I snapshot by filegroup? <\/span><\/strong><span style=\"font-size: 10pt; font-family: Verdana\">No, however if what you want to do is create a snapshot which does NOT include certain files &ndash; you can take those filegroups offline and then create the snapshot. In the snapshot the only file\/filegroups available will be those which were online when the snapshot was created&hellip;even if those files\/filegroups are brought online after the snapshot was created.<\/span><\/span>\n<\/p>\n<p>\n<span style=\"font-size: 11pt; color: black\"><span style=\"font-size: 10pt; font-family: Verdana\"><\/span><strong><span>Q: Could a reader be blocked on the snapshot DB while SQL updates the changed page? <\/span><\/strong><span style=\"font-size: 10pt; font-family: Verdana\">No. The copy on write mechanism is really a copy before write mechanism and the pages will be copied before the write and essentially before the locks, etc. The only possible &ldquo;blocking&rdquo; could be caused by the excess I\/Os that need to be performed. However, the I\/Os are performed only on the FIRST change to the page after the snapshot is created &ndash; so it&rsquo;s minimal!!<\/span><\/span>\n<\/p>\n<p>\n<span style=\"font-size: 11pt; color: black\"><span style=\"font-size: 10pt; font-family: Verdana\"><\/span><strong><span>Q: Are DMVs in SQL Server 2005 only?<\/span><\/strong><span style=\"font-size: 10pt; font-family: Verdana\">Yes, DMVs = Dynamic Management Views and these are a feature of SQL Server 2005.<\/span><\/span>\n<\/p>\n<p>\n<span style=\"font-size: 11pt; color: black\"><span style=\"font-size: 10pt; font-family: Verdana\"><\/span><strong><span>Q: Is read uncommitted the lowest\/least in terms of data consistency? <\/span><\/strong><span style=\"font-size: 10pt; font-family: Verdana\">Yes, read uncommitted is also known as &ldquo;dirty read.&rdquo; A dirty read is a read against an &ldquo;in-flight&rdquo; transaction; this transaction could be rolled back. As a result, the query that read that data would be inaccurate.<\/span><\/span>\n<\/p>\n<p>\n<span style=\"font-size: 11pt; color: black\"><span style=\"font-size: 10pt; font-family: Verdana\"><\/span><strong><span>Q: What is the effect of versioning on fragmentation and performance (I&#39;m assuming I create a split of the page is full)? <\/span><\/strong><span style=\"font-size: 10pt; font-family: Verdana\">Actually, I&rsquo;m not sure I&rsquo;m following this one&hellip; But &ndash; I think I can answer it by just giving you some insight into how things work. Versioning &ndash; in terms of the data overhead added to the data row &ndash; does add a 14 byte value to help store the offset. This overhead is added ONLY once, to each row, after one of the snapshot isolation options is turned on (either or both &ndash; the READ_COMMITTED_SNAPSHOT or ALLOW_SNAPSHOT_ISOLATION). When this 14 byte value is added to each of the rows, the additional 14-bytes might cause the page to split. Again, this is only a one-time addition. The trick to optimizing this structural change is to change the database option and then rebuild your indexes. This will make the data contiguous and versioning will have no additional affects on the data row.<\/span><span style=\"font-size: 10pt; font-family: Verdana\">&nbsp;<\/span><span style=\"font-size: 10pt; font-family: Verdana\">Now, if what you were thinking is that the versions were stored in the data row &ndash; then this is NOT the case. The version store comes from the TempDB and as a result, there is no additional overhead (over the 14-bytes) needed within the data row.<\/span><\/span>\n<\/p>\n<p>\n<span style=\"font-size: 11pt; color: black\"><span style=\"font-size: 10pt; font-family: Verdana\"><\/span><strong><span>Q: What if we&#39;re not using transactions? Will repeatable read still lock the table during the read (particularly if the select is long)? <\/span><\/strong><span style=\"font-size: 10pt; font-family: Verdana\">Repeatable reads locks &ndash; and holds &ndash; the resources as they are read. So, YES, in the case of a select statement, you will acquire and hold the read locks for the life of the transaction.<\/span><\/span>\n<\/p>\n<p>\n<span style=\"font-size: 11pt; color: black\"><span style=\"font-size: 10pt; font-family: Verdana\"><\/span><strong><span>Q: How much additional overhead does versioning require from the SQL Server engine? <\/span><\/strong><span style=\"font-size: 10pt; font-family: Verdana\">Most of the overhead comes from TempDB but there&rsquo;s also a bit of overhead in looking up the version. There are no direct numbers associated with the overhead but in a lot of cases you should think in terms of roughly 10% additional costs for your transaction&hellip; So, I guess the best point is that you will have slower overall performance when implementing row version; however, you might solve a lot of your blocking problems. Slower but not blocked is better than not running at all &ndash; even when it does run at all quickly. <\/span><span><span>J<\/span><\/span><span style=\"font-size: 10pt; font-family: Verdana\"><span>&nbsp; <\/span>In all seriousness though, if blocking is NOT your primary problem, you will add overhead without a possible benefit.<\/span><\/span>\n<\/p>\n<p>\n<span style=\"font-size: 11pt; color: black\"><span style=\"font-size: 10pt; font-family: Verdana\"><\/span><strong><span>Q: So, is it the <em>new<\/em> transaction data or the <em>old<\/em> transaction data held in the snapshot store (seems like it might be different for statement vs. transaction level snapshotting)? <\/span><\/strong><span style=\"font-size: 10pt; font-family: Verdana\">It&rsquo;s always the BEFORE image. The general process of the write is called &ldquo;copy on write&rdquo; but I think of it better as copy <u>before<\/u> write.<\/span><\/span>\n<\/p>\n<p>\n<span style=\"font-size: 11pt; color: black\"><span style=\"font-size: 10pt; font-family: Verdana\"><\/span><strong><span>Q: Can we optimize the snapshot store (different physical device, file group(s), etc.)? <\/span><\/strong><span style=\"font-size: 10pt; font-family: Verdana\">No. However, you should look at optimizing TempDB. There are multiple things that you might want to consider. I discuss those thing in this blog entry <a href=\"https:\/\/www.sqlskills.com\/blogs\/kimberly\/permalink.aspx?guid=8be9d388-b354-429f-8c98-e45989a4bebe\">here<\/a>.<\/span><\/span>\n<\/p>\n<p>\n<span style=\"font-size: 11pt; color: black\"><span style=\"font-size: 10pt; font-family: Verdana\"><\/span><strong><span>Q: If I don&rsquo;t need locking why shouldn&rsquo;t I use read-uncommitted? <\/span><\/strong><span style=\"font-size: 10pt; font-family: Verdana\">Hmm, you can&hellip; you just need to be aware of the fact that the data is &ldquo;dirty&rdquo; and is not guaranteed to persist.<\/span><\/span>\n<\/p>\n<p>\n<span style=\"font-size: 11pt; color: black\"><span style=\"font-size: 10pt; font-family: Verdana\"><\/span><strong><span>Q: Where does SQL store all the row versions (with snapshot isolation turned on)? <\/span><\/strong><span style=\"font-size: 10pt; font-family: Verdana\">The version store is in TempDB.<\/span><\/span>\n<\/p>\n<p>\n<span style=\"font-size: 11pt; color: black\"><span style=\"font-size: 10pt; font-family: Verdana\"><\/span><strong><span>Q: How do I view all of the Report options from the summary page? I am looking at Adventureworks (compatibility level = 90), but all that I see is the General report. <\/span><\/strong><span style=\"font-size: 10pt; font-family: Verdana\">Ah, ha! The new summary windows were added to after the beta II April CTP. So, what this tells me is that you&rsquo;re running a build lower than 9.00.1187.07. At this point, I&rsquo;d go for the September CTP which is build 9.001314.06.<\/span><\/span>\n<\/p>\n<p>\n<span style=\"font-size: 11pt; color: black\"><span style=\"font-size: 10pt; font-family: Verdana\"><\/span><strong><span>Q: This question is from previous webcast&#8230; Is there anything new with SQL 2005 that does datetime support data types? Time datatype or Date datatype only? <\/span><\/strong><span style=\"font-size: 10pt; font-family: Verdana\">No, SQL Server 2005 only includes the datetime datatype for date\/time data. However, by using &ldquo;custom types&rdquo; you can create your own types which are date only or time only (just for one example). There were separate SQLCLR types of date only and time only in SQL Server 2005; however these were non-native types and subsequently removed. Instead, they will be shipped as examples in a resource kit which ships after RTM.<\/span><\/span>\n<\/p>\n<p>\n<span style=\"font-size: 11pt; color: black\"><span style=\"font-size: 10pt; font-family: Verdana\"><\/span><strong><span>Q: Kimberly, the downloadable zip file from your blog for at least the first session will only unzip to a &quot;C:&quot; drive (which my system doesn&#39;t have ;^) Could you please re-zip it to allow election of the drive to which it should unzip? <\/span><\/strong><\/span><span style=\"font-size: 11pt; color: black\"><span>This one still perplexes me. I didn&rsquo;t set any options that would restrict this&hellip; <\/span><span style=\"font-size: 10pt; font-family: Verdana\"><\/span><span style=\"font-size: 10pt; font-family: Verdana\"><\/span>&nbsp;<\/span>\n<\/p>\n<p><span><font color=\"#000000\">For the next session, we&rsquo;re going to cover how SQL Server keeps plans, where you can look to see what&#39;s in cache AND how you can know better if the stored procedure&#39;s plan should be kept&#8230;or not? If you&rsquo;re interested in hearing more &#8211; here&rsquo;s the registration link:<\/span> <\/p>\n<p style=\"margin: 0in 0in 0pt\" class=\"MsoNormal\">\n<span><font color=\"#000000\"><strong><a href=\"https:\/\/msevents.microsoft.com\/cui\/Error.aspx?culture=en-US&amp;ErrorMsgID=ErrorMessage.EventDoesNotExist&amp;EventID=\">MSDN Webcast: A Primer to Proper SQL Server Development (Part&nbsp;7 of 10): Understanding Plan Caching and Optimizing Procedure Performance<\/a><\/strong><\/span>\n<\/p>\n<p><span><font color=\"#000000\">&nbsp;<\/span><span><font color=\"#000000\">See you on Friday!<\/span> <\/p>\n<p style=\"margin: 0in 0in 0pt\" class=\"MsoNormal\">\n<span style=\"font-size: 10pt; color: black\">kt<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Effectively Designing a Scalable and Reliable Database A Primer to Proper SQL Server Development SQL Server Mixed Workloads, Secondary Databases, Locking and Isolation, Part&nbsp;6 of 10 Presented by Kimberly L. Tripp, SQLskills.com Q: Can I view a recording of this webcast?Part&nbsp;6 can be replayed by clicking here. Q: Where can we get the demo scripts [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27,47,58,65],"tags":[],"class_list":["post-658","post","type-post","status-publish","format-standard","hentry","category-events","category-msdn-webcasts","category-resources","category-sql-server-2005"],"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/kimberly\/wp-json\/wp\/v2\/posts\/658","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/kimberly\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/kimberly\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/kimberly\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/kimberly\/wp-json\/wp\/v2\/comments?post=658"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/kimberly\/wp-json\/wp\/v2\/posts\/658\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/kimberly\/wp-json\/wp\/v2\/media?parent=658"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/kimberly\/wp-json\/wp\/v2\/categories?post=658"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/kimberly\/wp-json\/wp\/v2\/tags?post=658"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}