Quantcast
Channel: Entity Framework
Viewing all articles
Browse latest Browse all 10318

Edited Issue: UniqueIdentifier primary keys (GUIDs) should not be created as Clustered Indexes [614]

$
0
0
Hey guys,<br /><br />In my original request on Connect ( https://connect.microsoft.com/VisualStudio/feedback/details/587040/create-guid-ids-as-non-clustered-primary-keys-in-entity-framework ) I made the point that GUIDs should not be created on the db side as a Clustered Index, possibly very poorly at the time. Basically, GUIDs when inserted in as a clustered index primary key means that the table gets a perf hit as it needs to re-sort and insert the new row where appropriate.<br /><br />The work item you redirected me to shows your plan is to use sequential uniqueidentifiers to "fix" this: http://entityframework.codeplex.com/workitem/71<br /><br />Instead I'd like you to discuss just creating it as a Non-clustered Index Unique Constraint on the database side - you still get the primary key, you still get it indexed but you don't suffer the performance hit on the database - if this isn't the case as I believe and have read and been told by SQL MVP's then I'd be happy if you loop someone in on the discussion to correct me.<br /><br />That way we can still create random GUIDs on the client side, we can also insert new records in multiple instance of the database and not have replication concerns, and we don't need to resort to using sequential uniqueidentifiers on the database.

Viewing all articles
Browse latest Browse all 10318

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>