Skip to content

feat(partition): add query-pattern tie-breaker guidance#213

Open
BHUVANSH855 wants to merge 4 commits into
AzureCosmosDB:mainfrom
BHUVANSH855:fix-201-partition-rule-tiebreaker
Open

feat(partition): add query-pattern tie-breaker guidance#213
BHUVANSH855 wants to merge 4 commits into
AzureCosmosDB:mainfrom
BHUVANSH855:fix-201-partition-rule-tiebreaker

Conversation

@BHUVANSH855

@BHUVANSH855 BHUVANSH855 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

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 /id remains appropriate for point-read-dominated and write-heavy workloads.

Type of Change

  • 📝 New rule - Adding a new best practice rule
  • ✏️ Rule improvement - Updating an existing rule
  • 🆕 New skill - Adding an entirely new skill
  • 🐛 Bug fix - Fixing an issue with existing content
  • 📚 Documentation - Updating README, CONTRIBUTING, or other docs
  • 🔧 Build/Scripts - Changes to build process or scripts

Checklist

  • I have read the Contributing Guide
  • I ran npm run validate and it passed (repository currently contains unrelated validation failures)
  • I ran npm run build to regenerate AGENTS.md (if adding/updating rules)
  • My rule file follows the naming convention: {prefix}-{description}.md
  • My rule includes valid frontmatter (title, impact, tags)

Agent Testing

  • Tested with GitHub Copilot
  • Tested with Claude Code
  • Tested with Cursor
  • Tested with other agent: _____
  • N/A (documentation/rule guidance update)

Related Issues

Fixes #201

Additional Notes

Updated:

  • partition-high-cardinality.md
  • partition-query-patterns.md

Added explicit precedence guidance for cases where high cardinality and query-pattern alignment suggest different partition keys. The update preserves valid /id partition key scenarios while clarifying when query-pattern alignment should take precedence for read-heavy workloads.

Copilot AI review requested due to automatic review settings June 19, 2026 16:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread skills/cosmosdb-best-practices/rules/partition-high-cardinality.md Outdated
Comment thread skills/cosmosdb-best-practices/rules/partition-high-cardinality.md Outdated
Comment thread skills/cosmosdb-best-practices/rules/partition-query-patterns.md Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

Comment thread skills/cosmosdb-best-practices/rules/partition-query-patterns.md Outdated
Comment thread skills/cosmosdb-best-practices/rules/partition-high-cardinality.md Outdated
Comment thread skills/cosmosdb-best-practices/rules/partition-high-cardinality.md

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

Comment thread skills/cosmosdb-best-practices/rules/partition-high-cardinality.md
Comment thread skills/cosmosdb-best-practices/rules/partition-high-cardinality.md
Comment thread skills/cosmosdb-best-practices/rules/partition-query-patterns.md
@jaydestro

Copy link
Copy Markdown
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants