Skip to content

[Rule] Use stored procedures only for multi-document atomic operations within a single partition #174

Description

@sajeetharan

Stored procedures are often misused as a general server-side compute layer. They should only be used when you need atomicity across multiple items in a single partition and can't use transactional batch.

We need a rule clarifying:

  • Valid use case: multi-document ACID within one partition
  • Anti-patterns: using sprocs for single-item CRUD, cross-partition logic, or heavy computation
  • Limitations: 5-second timeout, single-partition scope, hard to debug
  • Prefer SDK-side logic + transactional batch for most scenarios

Category: \pattern-\ Design Patterns
Impact: Medium
Suggested file: \skills/cosmosdb-best-practices/rules/pattern-stored-procedure-scope.md\

References:


This is a good first issue! Follow the Contributing Guide and use the rule template to get started.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions