If I write a javascript store procedure in cosmos db and I loop through 1000 document and each doc is 1K size, does it cost me 1000 RU?
RU calculation doesn't work like that (eg you cannot simply assume 1K doc x 1000 = 1000 RU).
The most accurate way of determining the cost of your stored procedure is to examine the RU charge, which is returned in the headers following the call to the stored procedure.
The header is x-ms-request-charge
and is exposed via the returned headers in the SDK calls as well as raw REST calls.
In node/javascript, you'd make a call that looks something like:
client.executeStoredProcedure(sprocLink,params,options, function (err, doc, headers) {
...
})
You'd want to look at headers['x-ms-request-charge']
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With