Skip to content

Commit b9604fc

Browse files
authored
Update how-to-write-stored-procedures-triggers-udfs.md
Added request to use batch or bulk instead of stored procedure to those actions.
1 parent 179bfa9 commit b9604fc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

articles/cosmos-db/nosql/how-to-write-stored-procedures-triggers-udfs.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ To call a stored procedure, trigger, and user-defined function, you need to regi
3131
## <a id="stored-procedures"></a>How to write stored procedures
3232

3333
Stored procedures are written using JavaScript, they can create, update, read, query, and delete items inside an Azure Cosmos DB container. Stored procedures are registered per collection, and can operate on any document or an attachment present in that collection.
34-
34+
> [Note]
35+
> When it comes to stored procedure, Cosmos DB has different charging policy. Since, stored can essentially execute code and consume any number of RUs, we do upfront charging for each stored procedure execution. This is a defense mechanism in backend to ensure stored procedure scripts do not impact out backend services. The amount which is charged upfront is the average charge consumed by the script in previous invocations. If the stored procedure has varied RUs per invocation i.e., lot of variance around the mean then the client may not be able to fully utilize the budget as we always reserve the average RU per operations before we start the execution. As an alternative we would suggest the client to use batch or bulk requests instead of stored procedures to avoid the variance around the RU charging.
36+
>
3537
Here is a simple stored procedure that returns a "Hello World" response.
3638

3739
```javascript

0 commit comments

Comments
 (0)