title: Is there a specific performance issue with Entity Framework + GUID PKs?
body: <p>My company has a basic SOA, using Entity Framework for database access. One of our services must interface with a legacy database which uses <code>uniqueidentifier</code> primary keys in the database. Performance is good during unit and integration testing.</p>
  
  <p>However, under load, the affected service starts to produce a backlog of queued requests. This queue can be eliminated by removing the code sections which use Entity Framework to match rows by uniqueidentifier PK. The service then becomes performant again, matching rows by integer PK as part of the same routines, using the same ObjectContext.</p>
  
  <p>The database table performs well being queried by the legacy application which it was designed for. I therefore do not believe this problem to be related to fragmentation within the database/index.</p>
  
  <p>In the code sample shown, <code>domain</code> is an Entity Framework ObjectContext, <code>MetaSetting</code> relates to the mapped EntityObject and <code>match.ObjectId</code> is a <code>Guid</code>.</p>
  
  <pre><code>metaSettings = domain.MetaSetting.Where(
      ms =&gt; ms.AppUID.Equals(match.ObjectId)  
  ).ToList();
  </code></pre>