feat(partition): add query-pattern tie-breaker guidance#213
Open
BHUVANSH855 wants to merge 4 commits into
Open
feat(partition): add query-pattern tie-breaker guidance#213BHUVANSH855 wants to merge 4 commits into
BHUVANSH855 wants to merge 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Cosmos DB partitioning best-practice rules to add a tie-breaker when high-cardinality guidance conflicts with query-pattern alignment, emphasizing that for read-heavy workloads the dominant access pattern should often drive partition key choice.
Changes:
- Added a “Cardinality vs. Query Patterns” tie-breaker section to
partition-high-cardinality. - Added a “Query Alignment vs. Cardinality” tie-breaker section to
partition-query-patterns, with cross-references between the rules.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| skills/cosmosdb-best-practices/rules/partition-query-patterns.md | Adds tie-breaker guidance prioritizing dominant read access patterns when cardinality and query alignment conflict. |
| skills/cosmosdb-best-practices/rules/partition-high-cardinality.md | Clarifies that high cardinality isn’t the sole factor, and adds guidance on when /id is appropriate vs. when query alignment should win. |
Contributor
|
@BHUVANSH855 there are some ongoing changes being evaluated to the structure that could require this to be modified. you'll definetely get notice when it's time to make any changes to avoid merge conflicts. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds tie-breaker guidance for partition key selection when high cardinality and query-pattern alignment conflict.
This update clarifies that for read-heavy workloads, aligning the partition key with the dominant access pattern may be preferable to maximizing cardinality with
/id, while preserving existing guidance that/idremains appropriate for point-read-dominated and write-heavy workloads.Type of Change
Checklist
npm run validateand it passed (repository currently contains unrelated validation failures)npm run buildto regenerate AGENTS.md (if adding/updating rules){prefix}-{description}.mdtitle,impact,tags)Agent Testing
Related Issues
Fixes #201
Additional Notes
Updated:
partition-high-cardinality.mdpartition-query-patterns.mdAdded explicit precedence guidance for cases where high cardinality and query-pattern alignment suggest different partition keys. The update preserves valid
/idpartition key scenarios while clarifying when query-pattern alignment should take precedence for read-heavy workloads.