﻿# Concatenated Zstandard frames do not supply a seek index

Independent compressed frames support separate decoding, but random subrange lookup needs a valid seek table and decoded-to-stored offset mapping.

Author: Retrivium team
Updated: 2026-11-06
Canonical URL: https://retrivium.ai/journal/zstd-seekable-frame-index-boundary/
Language: en

## Independent frames still need to be located

A dataset publisher compresses several independent Zstandard frames and labels the file randomly accessible. A reader knows an offset in the decompressed dataset but has no map to the corresponding compressed frame. Independent decoding does not itself solve locating the needed bytes.

The [base format specification](https://raw.githubusercontent.com/facebook/zstd/dev/doc/zstd_compression_format.md) defines independent concatenated frames while explicitly excluding random access as its goal. The [seekable format](https://raw.githubusercontent.com/facebook/zstd/dev/contrib/seekable_format/zstd_seekable_compression_format.md) adds the missing indexing structure; these are related but different format contracts.

## Keep both offset domains

An application record has an offset in the decompressed byte sequence. The storage service receives offsets in the compressed file. Those coordinates generally differ because each frame has its own compressed and decompressed size.

The seek table records both sizes. Cumulative sizes locate frame boundaries in the respective domains. To read a semantic record, identify the covering frames, retrieve their compressed ranges and decode the necessary contents before selecting the record's actual bytes.

## Validate the terminal index

The seekable format places its table in a final skippable frame and defines a footer that lets a decoder recognize it from the end. The specification warns against identifying the table solely from a skippable-frame magic value, which can appear in other valid custom frames.

Check table structure, frame count and size accounting before trusting offsets. A truncated download or malformed footer should be rejected as an invalid index, not treated as an empty dataset. Preserve the immutable file identity with any separately cached table.

## Qualify the decoder's real support

A decoder that reads ordinary Zstandard streams does not necessarily implement seekable access. It may sequentially decode the file correctly while ignoring skippable metadata. Verify the chosen library's documented interface and the application's actual range-reading path.

The optional per-frame checksum has a defined format and limited corruption-detection role. It does not authenticate the dataset publisher or replace trusted artifact identity. Keep checksum validation and provenance checks separate from index validation.

## Acceptance for range retrieval

Use a known fixture containing records wholly within a frame and records crossing frame boundaries. Compare retrieved decoded bytes with the corresponding full-decode result. Include a missing footer, inconsistent size entry and stale cached table as negative cases in an isolated parser test.

[Storage placement](/journal/storage-optimized-hosting/) connects range-read design to model loading. [Object version identity](/journal/guide-storage-object-version-id/) explains why an index must remain bound to the exact compressed artifact rather than a mutable object key.

## Choose the publication format explicitly

Seekable frames trade indexing and frame granularity against compression and retrieval work; no universal performance improvement is asserted. A valid stream with no seek table can still be perfectly suitable for sequential loading. The acceptance question is whether the published artifact supplies the verified offset map required by this reader, without inferring that property from a filename extension or the presence of multiple frames.
