azure - How to measure RU in DocumentDB? -


given azure documentdb uses requests units measurement throughput make sure queries utilize least amount of rus possible ncrease throughput. there tool tell me how many rus query take , if query using index or not?

as discovered, tools provide ru's upon completion of query. available programmatically, x-ms-request-charge header returned in response, , retrievable via documentdb sdks.

for example, here's snippet showing ru retrieval using js/node:

var queryiterator = client.querydocuments(colllink, queryspec ); queryiterator.executenext(function (err, results, headers) {   if (err) {     // deal error...   } else {     // deal payload...     var ruconsumed = headers['x-ms-request-charge'];   } }); 

as far question regarding indexing, , determining if property indexed (which should answer question query using or not using index): may query collection, returns indexing details in response header.

for example: given path dbs/<databaseid>/colls/<collectionid>:

var colllink = 'dbs/' + databaseid+ '/colls/'+ collectionid;  client.readcollection(colllink, function (err, coll) {     if (err) {         // deal error      } else {         // compare indexingpolicy property, see if it's included or excluded         // shows these properties         console.log("included: " + json.stringify(coll.indexingpolicy.includedpaths))         console.log("excluded: " + json.stringify(coll.indexingpolicy.excludedpaths))     } }); 

you'll see includedpaths , excludedpaths looking this, , can search given property in way see fit:

included: [{"path":"/*","indexes":[{"kind":"range","datatype":"number","precision":-1},{"kind":"hash","datatype":"string","precision":3}]}] excluded: [] 

Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -