title: DocumentDB Index Performance / Fragmentation
body: <p>I have decided to implement the following ID strategy for my documents, which combines the document "type" with the ID:</p>
  
  <pre><code>doc.id = "docType_" + Guid.NewGuid().ToString("n");
  
  // create document in collection
  </code></pre>
  
  <p>This results in IDs such as the following for my documents:</p>
  
  <p><code>usr_19d17037ea7f41a9b20db1a90f71d30d</code><br>
  <code>usr_89fe82c93b264076aa1b6e1fb4813aaf</code><br>
  <code>usr_2aa58c1c970a4c5eaa206a755c1c7bf4</code><br>
  <code>msg_ec43510732ae47a6a5d5f323b7461d68</code><br>
  <code>msg_3b03ceeb7e06490d998c3e368b435851</code></p>
  
  <p>With a <code>RangeIndex</code> policy in place on the ID, I should be able to query the collection for specific types. For example:</p>
  
  <pre><code>SELECT * FROM c WHERE STARTSWITH(c.id, 'usr_') AND ...
  </code></pre>
  
  <p>Since this is a web application with many different document types, many of my app's queries would implement this <code>STARTSWITH</code> filter by default.</p>
  
  <p>My main concern here is the use of a random GUID string on the ID. I know that in SQL Server I have had issues with index performance and fragmentation while using random GUIDs on the primary key in a clustered index.</p>
  
  <p>Is there a similar concern here? It seems that in DocumentDB, the care of managing indexes has been abstracted away from you. Would a sequential ID be more ideal/performant in any way?</p>