# Choose Efficient Loading and Writes

RECAP provides explicit controls for relationship hydration and known-record updates. Use them to avoid loading more of the provenance graph than a task requires.


# Keep query payloads small

Use references for identity-only results, explicit relationship paths for targeted hydration, and pagination for large result sets. See [Choose query shape and loading](../../docs/how-to/choose-query-shape-and-loading.md), [Query Resources](../../docs/how-to/query-resources.md), and [Query Process Runs](../../docs/how-to/query-process-runs.md).

Use [descendants()](../../reference/ResourceQuery.md#recap.ResourceQuery.descendants) or [under_parent()](../../reference/ResourceQuery.md#recap.ResourceQuery.under_parent) for targeted resource subtree queries instead of eager-loading an entire large hierarchy. See [Trace Provenance](../../docs/how-to/provenance-queries.md) for traversal patterns.


# Test suites

Run default tests with `pixi run test`. This excludes SQL statement-budget regressions. Run those regressions with `pixi run test-performance`; run all tests with `pixi run test-all` before release or when changing query loading.


# Update known records by ID

Builders accept `resource_id=` and `process_run_id=` for existing records. These paths avoid probing by name and avoid an insert-conflict-rollback-select cycle. See [Use revisions and idempotency](../../docs/how-to/use-revisions-and-idempotency.md) for known-ID update procedures.

``` python
with namespace.build_resource(resource_id=resource_id) as builder:
    resource = builder.get_model()
    resource.properties.status.used = True
    builder.set_model(resource)
```


# Group work by namespace

Namespace context controls visibility and authorization. Reuse one namespace client for a batch of related operations rather than repeatedly switching contexts.
