{"id":550,"date":"2009-03-04T15:03:00","date_gmt":"2009-03-04T15:03:00","guid":{"rendered":"\/blogs\/kimberly\/post\/Seriously-are-you-kidding-me.aspx"},"modified":"2013-01-02T06:56:32","modified_gmt":"2013-01-02T14:56:32","slug":"seriously-are-you-kidding-me","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/kimberly\/seriously-are-you-kidding-me\/","title":{"rendered":"Seriously, are you kidding me?"},"content":{"rendered":"<p>\n<font face=\"verdana,geneva\">**** UPDATE March&nbsp;17, 2009 ****<br \/>\n<strong><u>Be sure to read the comments. <br \/>\n<\/u><\/strong>This doesn&#39;t appear to be as bad&nbsp;as it seemed&#8230;still glad I&nbsp;did the rant though; I learned more about what it&#39;s <em>actually <\/em>doing!&nbsp;:)&nbsp;<br \/>\n<font face=\"verdana,geneva\"><strong>And, it&#39;s still good to have good database design &#8211; NO MATTER WHAT!<br \/>\n<\/strong>****\n<\/p>\n<p>\n<font face=\"tahoma,arial,helvetica,sans-serif\" size=\"2\">OK&#8230; today&#39;s been a bit of a weird day. I&#39;ve been doing research for some upcoming events and in general, I&#39;m learning a few things. However, as one does with the web &#8211; you can get side-tracked. And, in watching the video (recommended by my good friend <a href=\"http:\/\/blogs.interknowlogy.com\/author\/timhuckaby\/\" target=\"_blank\" class=\"broken_link\">Timmie<\/a>) highlighed in this blog post about DBAs and Developers: <a href=\"http:\/\/www.benhblog.com\/2009\/03\/linq-dba-vs-developer.html\"><font face=\"tahoma,arial,helvetica,sans-serif\" size=\"2\">http:\/\/www.benhblog.com\/2009\/03\/linq-dba-vs-developer.html<\/a><font face=\"tahoma,arial,helvetica,sans-serif\" size=\"2\">, I followed a few other links as well and found this direct quote:\n<\/p>\n<blockquote>\n<p>\n\t<font face=\"tahoma,arial,helvetica,sans-serif\" size=\"3\">&quot;<em><font face=\"times new roman,times\">I was surprised to learn that EF decided that since there was not a primary key it would just use all the non-nullable columns as a concatenated primary key.&nbsp; This might not be what you want.<\/em>&quot;\n\t<\/p>\n<\/blockquote>\n<p>\n<font face=\"tahoma,arial,helvetica,sans-serif\" size=\"2\">This quote is also from Ben&#39;s blog (and I agree) and specifically this post: <a href=\"http:\/\/www.benhblog.com\/2008\/11\/entity-framework-and-tables-with-no.html\"><font face=\"tahoma,arial,helvetica,sans-serif\" size=\"2\">http:\/\/www.benhblog.com\/2008\/11\/entity-framework-and-tables-with-no.html<\/a>. And, <a href=\"http:\/\/blog.davidyack.com\/\" target=\"_blank\">David Yack<\/a> (a fellow <a href=\"http:\/\/www.theregion.com\/\" target=\"_blank\" class=\"broken_link\">RD<\/a>) makes a GREAT comment that you can deselect this but <strong><u>I honestly cannot believe that this is the default<\/u><\/strong>???!\n<\/p>\n<p>\n<font face=\"tahoma,arial,helvetica,sans-serif\" size=\"2\">My response is&#8230;&#8230;. <strong><font size=\"4\">Seriously, are you FREAKING kidding me?<\/strong>\n<\/p>\n<p>\n<font face=\"tahoma,arial,helvetica,sans-serif\" size=\"2\">OK, I don&#39;t want to go on a total rant here but this is so bad that I almost cannot believe it. And, well, it&#39;s somewhat par for the course with the day that I&#39;m having (with other things that I&#39;ve learned and been &quot;working on&quot;). I&#39;ll come back to more topics that fall under the category of &quot;are you kidding me&quot; in a second. Ah ha&#8230; there&#39;s a new category for me!!!\n<\/p>\n<p>\n<font face=\"tahoma,arial,helvetica,sans-serif\" size=\"2\">Anyway, why is that so bad?\n<\/p>\n<ol>\n<li>\n<div>\n\t<font face=\"tahoma,arial,helvetica,sans-serif\" size=\"2\">There&#39;s no guarantee that all non-null columns are even going to be unique (but, this is the LEAST of the problems)\n\t<\/div>\n<\/li>\n<li>\n<div>\n\t<font face=\"tahoma,arial,helvetica,sans-serif\" size=\"2\">Making a WIDE composite PRIMARY KEY means that the underlying structure which is a UNIQUE CLUSTERED INDEX won&#39;t be as efficient. SQL Server creates this index to enforce the relational rule for a PRIMARY KEY-that it is UNIQUE. So, SQL Server will make this WIDE COMPOSITE SET OF COLUMNS the table&#39;s one and only clustered index (ugh &#8211; I hope at least it changes the index type to nonclustered&#8230;. someone please let me know if this is the case)?? However, if it&#39;s not&#8230;. then, the clustered index will now force SQL Server to order this table by this combination of columns (which probably don&#39;t have any form of pattern) so, this clustered index is probably going to be very prone to fragmentation (which in turn can negatively affect performance). And, even worse, ALL of the non-clustered indexes will ALSO be rebuilt to include ALL of the columns of the clustered index which are not already in the non-clustered index. In fact, this step alone &#8211; if a clustered index&nbsp;IS created &#8211; will cause ALL of the nonclustered indexes to be rebuilt in addition to the table being rebuilt.\n\t<\/div>\n<\/li>\n<\/ol>\n<p>\n<font face=\"tahoma,arial,helvetica,sans-serif\" size=\"2\">So, please tell me this isn&#39;t the case? Sorry if this is a rant but I honestly cannot believe this one.\n<\/p>\n<p>\n<font face=\"tahoma,arial,helvetica,sans-serif\" size=\"2\">This is another reason where people just weren&#39;t even thinking about what was going on in the backend. Another scenario where a little bit of background knowledge of the &quot;data store&quot; would have REALLY helped.\n<\/p>\n<p>\n<font face=\"tahoma,arial,helvetica,sans-serif\"><strong>Oh my?<br \/>\n<\/strong>kt<\/p>\n","protected":false},"excerpt":{"rendered":"<p>**** UPDATE March&nbsp;17, 2009 **** Be sure to read the comments. This doesn&#39;t appear to be as bad&nbsp;as it seemed&#8230;still glad I&nbsp;did the rant though; I learned more about what it&#39;s actually doing!&nbsp;:)&nbsp; And, it&#39;s still good to have good database design &#8211; NO MATTER WHAT! **** OK&#8230; today&#39;s been a bit of a weird [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,36],"tags":[],"class_list":["post-550","post","type-post","status-publish","format-standard","hentry","category-are-you-kidding-me","category-indexes"],"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/kimberly\/wp-json\/wp\/v2\/posts\/550","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=550"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/kimberly\/wp-json\/wp\/v2\/posts\/550\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/kimberly\/wp-json\/wp\/v2\/media?parent=550"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/kimberly\/wp-json\/wp\/v2\/categories?post=550"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/kimberly\/wp-json\/wp\/v2\/tags?post=550"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}