Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding the x-ms-resource-usage in DocumentDB response header

While performing a simple Get operation by Id where a single document is returned (not an array with one document) I get the following x-ms-resource-usage:

x-ms-resource-usage:documentSize:0;documentsSize:288;collectionSize=307;

Questions:

  • Why is documentSize 0?
  • What is the unit of measure? Bytes?
  • What is the difference between documentSize and documentsSize? Please note the query only returns one document.
  • What is the collectionSize? Is that the total number of documents in the collection?
  • What is the difference between x-ms-resource-usage and x-ms-resource-quota?
like image 596
Jonas Stawski Avatar asked Feb 08 '16 16:02

Jonas Stawski


People also ask

How do I get master key for Cosmos DB?

Master key tokens The master key token is the all access key token that allows users to have full control of Cosmos DB resources in a particular account. The master key is created during the creation of an account. There are two sets of master keys, the primary key and the secondary key.

How do I find the document ID for Cosmos DB?

Note that the {databaseaccount} is the name of the Azure Cosmos DB account created under your subscription. The {db-id} value is the user generated name/ID of the database, not the system generated ID (rid). The {coll-id} value is the name of the collection. The {doc-id} value is the ID of the document to be retrieved.

How do I write a stored procedure in Azure Cosmos DB?

Create Simple Stored ProcedureIn the Azure Cosmos DB blade, locate and select the Data Explorer link on the left side of the blade. In the Data Explorer section, expand the NutritionDatabase database node and then expand the FoodCollection container node. Within the FoodCollection node, select the Items link.

What is document ID in Cosmos DB?

The ID element is a unique string that is user-settable and must not exceed 255 characters. You can insert, replace, delete, read, enumerate, and query arbitrary JSON documents in a collection. Azure Cosmos DB does not require any schema or secondary indexes in order to support querying over documents in a collection.


1 Answers

I'm fairly sure the numbers are as follows, and all in KB:

  • documentSize: Size of the document
  • documentsSize: Combined size of all documents in collection
  • collectionSize: Combined size of all documents in collection, along with overhead such as indexes

x-ms-resource-usage is about consumed resources within the collection, while x-ms-resource-quota is going to give you your limits. So with quota, you'll see documentsSize and collectionSize both set to something like 10485760, which is 10GB (10,485,760 MB).

like image 128
David Makogon Avatar answered Nov 15 '22 04:11

David Makogon