Skip to content

[Rule] Prefer ReadItem (point read) over query for single-document lookup by id + partition key #170

Description

@sajeetharan

We have \query-point-reads.md\ but it focuses on when to use point reads vs queries. We're missing a complementary rule specifically about the common anti-pattern: using \SELECT * FROM c WHERE c.id = @id\ when you already know the partition key value — which costs 2-10x more RUs than a direct ReadItem.

This rule should focus on:

  • Code patterns showing the wrong query approach vs. ReadItemAsync
  • RU cost comparison (1 RU point read vs. ~3+ RU for query)
  • Multi-language examples (.NET, Java, Python, Node.js)

Category: \sdk-\ SDK Best Practices
Impact: High
Suggested file: \skills/cosmosdb-best-practices/rules/sdk-read-item-over-query.md\

References:


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

Metadata

Metadata

Assignees

No one assigned

    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