# Queries need result bounds

> For agents: start with the [agent guide](https://ratstack.sh/llms.txt). Every page is Markdown by default; add `Accept: text/html` for HTML.

Free workshop: [Build Agent Loops That Never Stop Shipping](/tokenmaxx#interested).

A timeout can limit waiting while leaving a large result problem intact. Limit query results explicitly and choose a bounded consumption path.

Book basis: [B4](/lore/durability-bibliography#b4-release-it).

## Failure it prevents

One query exhausts memory despite a concurrency limit of one.

## Our Effect 4.0.0 reading

`Stream.take` bounds consumption of a real stream. It cannot undo a driver’s full allocation. Apply limits or cursor pagination in the query [adapter](/lore/hexagonal-architecture).

Source: `packages/effect/src/Stream.ts`.

## How to check

Use a dataset larger than the intended result budget. Check rows fetched and memory before consumption completes. This check is our proposal. The books do not prescribe it.

Continue with [Steady state recycles resources](/lore/steady-state-recycles-resources), [Bulkheads isolate scarce capacity](/lore/bulkheads-isolate-capacity).

Connect this to [the existing rat-stack guidance](/lore/concurrent-work-needs-an-owner).

Use [the durability skill](/skills/durability) for the full review. Return to [the durability index](/lore/durability).

## Sources

1. [Nygard, Michael T. Release It!: Design and Deploy Production-Ready Software. Pragmatic Bookshelf, 2007.](https://archive.org/details/releaseitdesignd0000nyga)
   Pragmatic Bookshelf. §4.4 Unbounded Result Sets; Chapter 5 Stability Patterns: §5.1 Timeouts, §5.2 Circuit Breaker, §5.3 Bulkheads, §5.4 Steady State, §5.5 Fail Fast, §5.6 Handshaking, §5.7 Test Harness, §5.8 Decoupling Middleware. Accessed 2026-10-23.

2. [Effect contributors. Effect 4.0.0. Stream.ts](https://github.com/Effect-TS/effect/blob/67ba4e46a11ccda0b6761578bfd22c04ae00167d/packages/effect/src/Stream.ts)
   Effect-TS. Pinned source for our Effect mapping, not a claim from the book. Accessed 2026-10-23.

## Lore on this page

- [Timeouts bound waiting](/lore/timeouts-bound-waiting)

## Linked from

- Agent guide → An Effect stack so pure (aspirational) Kit Langton will blush. → [Read page](https://ratstack.sh/llms.txt)

- Change log → What changed in the files served here, newest first. → [Read page](https://ratstack.sh/log)

- Durability starts with a recovery record → A reading order for storage, replay, worker ownership, overload, and recovery tests. → [Read page](https://ratstack.sh/lore/durability)

- Full agent guide → An Effect stack so pure (aspirational) Kit Langton will blush. → [Read page](https://ratstack.sh/llms-full.txt)

- Rat Stack lore | rat-stack → Short, source-grounded notes on the ideas and decisions behind rat-stack. → [Read page](https://ratstack.sh/lore)

- Source change history (log.md) → The generated change log as Markdown. → [Read page](https://ratstack.sh/log.md)

- Steady state recycles resources → Every accumulation needs a deliberate recycling policy. → [Read page](https://ratstack.sh/lore/steady-state-recycles-resources)
