Hierarchical partition keys guidance on Partial PK#363
Hierarchical partition keys guidance on Partial PK#363ananth7592 wants to merge 1 commit intoMicrosoftDocs:mainfrom
Conversation
|
@ananth7592 : Thanks for your contribution! The author(s) and reviewer(s) have been notified to review your proposed change. |
|
@ananth7592 : Thanks for your contribution! The author(s) and reviewer(s) have been notified to review your proposed change. |
|
Learn Build status updates of commit ea7d712: ✅ Validation status: passed
For more details, please refer to the build report. |
| When the query specifies all values of the partition keys in the `WHERE` filter or in a prefix of the key hierarchy, the SDK automatically routes the query to the corresponding physical partitions. Queries that provide only the "middle" of the hierarchy are cross-partition queries. | ||
|
|
||
| For queries intending to use a partial prefix of the hierarchical partition key path, you must explicitly include the partial prefix in the **WHERE** clause to be efficiently routed. Relying solely on supplying values via `PartitionKeyBuilder` does not currently guarantee efficient query execution. Queries that omit the partition key in the **WHERE** clause might incur significantly higher RU costs. | ||
|
|
There was a problem hiding this comment.
There are already existing examples just below this section that cover this scenario. https://learn.microsoft.com/en-us/azure/cosmos-db/hierarchical-partition-keys?tabs=net-v3%2Cbicep#run-a-query
Please take a look and let me know if they make sense for the guidance
There was a problem hiding this comment.
None of the examples explicitly mention hierarchical PK, may be we need to clarify existing example or add a new one.
There was a problem hiding this comment.
This example below is covering the where clause condition that is being mentioned in the guidance
SELECT * FROM c WHERE c.TenantId = 'Microsoft' | Routed to only the targeted subset of logical and physical partition(s) that contain data for the specified value of TenantId. This query is a targeted cross-partition query that returns data for all users in a tenant. -- | --|
Can you review the proposed changes? IMPORTANT: When the changes are ready for publication, adding a #label:"aq-pr-triaged" |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds guidance to the hierarchical partition keys documentation to clarify query routing behavior when only a prefix of the hierarchical partition key is provided.
Changes:
- Documented that partial-prefix query routing requires the prefix to be present in the
WHEREclause - Warned that relying only on
PartitionKeyBuildermay not ensure efficient routing and can increase RU costs
ea7d712 to
f865b0e
Compare
|
Learn Build status updates of commit f865b0e: ✅ Validation status: passed
For more details, please refer to the build report. |
No description provided.