Does Documentdb execute the stored procedure on all sections of the collection?

Is it possible to execute a stored procedure for an entire collection of sections. if not how can i archive without round trips?

Thanks in Advance.

+3


source to share


1 answer


No, sprocs run in the same section, and there is no automatic shutdown for sprocs to run. You need to specify the partition key when calling them.

Assuming you meant "achievement" and not "archive", my first suggestion is to create your application and choose your pk so that it is available every time you call. Otherwise, your only option is to branch manually. You can do this in parallel so that latency is marginally greater than hitting a single partition, but it will consume n times more RUs, so overall RU bandwidth limits may limit you.



The tricky thing about doing a fan is that you have no control over the quantity and ranges for your sections in a partitioned collection. Thus, you need to get them before making your splitter. I don't know about other SDKs, but I have not seen it directly supported in the node.js SDK. However, the REST API implements an endpoint for this, https://{your endpoint domain}.documents.azure.com/dbs/{your collection uri fragment}/pkranges

so you might have to call this directly depending on your SDK. This will show you the current pks ranges for each section in the collection. The minimum is included, so you can use this to make sproc calls.

+4


source







All Articles