{"id":122,"date":"2006-05-15T00:00:00","date_gmt":"2006-05-30T00:00:00","guid":{"rendered":"https:\/\/test.simple-talk.com\/uncategorized\/sql-server-performance-testing\/"},"modified":"2021-06-03T16:44:23","modified_gmt":"2021-06-03T16:44:23","slug":"sql-server-performance-testing","status":"publish","type":"post","link":"https:\/\/www.red-gate.com\/simple-talk\/databases\/sql-server\/performance-sql-server\/sql-server-performance-testing\/","title":{"rendered":"SQL Server Performance Testing"},"content":{"rendered":"<h2>Clustered indexes and primary keys<\/h2>\n<p>The company I work is for is implementing a custom system, built in Visual Studio and running against SQL Server 2000, to replace some old mainframe applications. It&#8217;s an all new database design that will meet all of the old application data requirements and a whole slew of new ones. I was responsible for the initial design, which I completed and handed over to a development team. I had been working quite closely with them for some time on the application, but I got pulled in other directions and the app and database had proceeded without me. One day, the development team raised a concern that the database was far too slow to support the anticipated transaction load. I began my investigation.<\/p>\n<h3>The problem<\/h3>\n<p>The application in question has a few data requirements that are different than the average application. Basically, at its heart, it is a document management system. However, every change to large sections of the data has to be stored historically, so that we have multiple versions of pieces of a given document. Not all of the data stored is recreated for each version. We needed to know that change &#8216;A&#8217; was included in version &#8216;1&#8217;, but that change &#8216;B&#8217; was in version &#8216;3&#8217; and, on a completely different piece of data, read another table, and know that change &#8216;Q&#8217; was included in version &#8216;2&#8217;. The data looks something like this:<\/p>\n<p><i>Table 1<\/i><\/p>\n<p>&nbsp;<\/p>\n<table>\n<tbody>\n<tr>\n<td valign=\"top\">\n<p>Version<\/p>\n<\/td>\n<td valign=\"top\">\n<p>Value<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">\n<p>1<\/p>\n<\/td>\n<td valign=\"top\">\n<p>&#8216;A&#8217;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">\n<p>2<\/p>\n<\/td>\n<td valign=\"top\">\u00a0<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">\n<p>3<\/p>\n<\/td>\n<td valign=\"top\">\n<p>&#8216;B&#8217;<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><i>Table 2<\/i><\/p>\n<p>&nbsp;<\/p>\n<table>\n<tbody>\n<tr>\n<td valign=\"top\">\n<p>Version<\/p>\n<\/td>\n<td valign=\"top\">\n<p>Value<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">\n<p>1<\/p>\n<\/td>\n<td valign=\"top\">\n<p>&#8216;Some other value&#8217;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">\n<p>2<\/p>\n<\/td>\n<td valign=\"top\">\n<p>&#8216;Q&#8217;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">\n<p>3<\/p>\n<\/td>\n<td valign=\"top\">\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>When queries are run, the latest data in Table 1 is &#8216;B&#8217; from version three and the latest data in Table 2 is &#8216;Q&#8217; from version 2.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When faced with two viable solutions to a badly compromised database design, one using clustered indexes and the other compound primary keys, Grant Fritchey took the only sensible route: he gathered hard performance data&#8230;&hellip;<\/p>\n","protected":false},"author":221792,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[143529],"tags":[4168,4197,4206,4150,4151,4208],"coauthors":[6785],"class_list":["post-122","post","type-post","status-publish","format-standard","hentry","category-performance-sql-server","tag-database","tag-database-design","tag-performance","tag-sql","tag-sql-server","tag-testing"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/122","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/users\/221792"}],"replies":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/comments?post=122"}],"version-history":[{"count":3,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/122\/revisions"}],"predecessor-version":[{"id":74928,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/122\/revisions\/74928"}],"wp:attachment":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media?parent=122"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/categories?post=122"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/tags?post=122"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/coauthors?post=122"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}