# Sequential Access

> A design pattern that reads a source in its stored order through a cursor or scan, instead of looking records up one by one.

Record: `architecture:sequential-access`
Kind: pattern
Layer: [Execution Core](https://banes-lab.com/records/layer/execution-core.md)
Severity: contextual
Scope: file, stream, iterator
Canonical: https://banes-lab.com/ontology#architecture-sequential-access

Listed in [Architecture principles](https://banes-lab.com/api/records/architecture.md), after [Lazy Evaluation](https://banes-lab.com/records/architecture/lazy-evaluation.md) and before [Forward-Only Processing](https://banes-lab.com/records/architecture/forward-only-processing.md).

## Repair

- Refactored by: Use Buffer/Index or Stream Sequentially
- Detected by: seek/index assumptions on sequential source
- Violated by: random access over stream-only source
- Measured by: access pattern cost
- Enforced by: performance tests

## Requires

- [Ordered Read Model](https://banes-lab.com/records/lexicon/ordered-read-model.md)

## Reinforces

- [Memory Efficiency](https://banes-lab.com/records/architecture/memory-efficiency.md)

## Enables

- [Large Data Processing](https://banes-lab.com/records/lexicon/large-data-processing.md)

## In tension with

- [Lookup Performance](https://banes-lab.com/records/lexicon/lookup-performance.md)
- [Random Access Requirement](https://banes-lab.com/records/lexicon/random-access-requirement.md)

## Tensions

- [Sequential Access / Lookup Performance](https://banes-lab.com/records/tension/lookup-performance-sequential-access.md)
- [Sequential Access / Random Access Requirement](https://banes-lab.com/records/tension/random-access-requirement-sequential-access.md)

## Severity

- [contextual](https://banes-lab.com/records/vocabulary/severity-contextual.md)

## Category

- [Streaming / Pipeline / Dataflow Processing](https://banes-lab.com/records/architecture-category/streaming-pipeline-dataflow-processing.md)

## Linked from

- [Scalability / Performance / Optimization](https://banes-lab.com/ontology/principles/architecture-category-scalability-performance-optimization.md)
- [Streaming / Pipeline / Dataflow Processing](https://banes-lab.com/ontology/lexicon/lexicon-category-streaming-pipeline-dataflow-processing.md)
- [Severity levels](https://banes-lab.com/ontology/schema/the-vocabulary-severity.md)
- [The resolutions](https://banes-lab.com/ontology/schema/the-resolutions.md)
