Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions articles/cosmos-db/hierarchical-partition-keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,8 @@ The SDK code that you use to run a query on a subpartitioned container is identi

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 that target a prefix of the hierarchical partition key path, you should include those leading partition key values in the **WHERE** clause so the query can be routed efficiently. Supplying values only via `PartitionKeyBuilder` doesn't by itself guarantee efficient routing. Queries that omit partition key values from the **WHERE** clause might incur significantly higher RU costs.

Comment thread
ananth7592 marked this conversation as resolved.
For example, consider a hierarchical partition key that's composed of `TenantId` > `UserId` > `SessionId`. The components of the query's filter determines if the query is a single-partition query, a targeted cross-partition query, or a fan-out query.

| Query | Routing |
Expand Down