Skip to main content

Storage

LiteJoin uses SQLite as its primary data store, with optional tiered storage for long-term retention.

SQLite Sharding

Data is distributed across multiple SQLite databases using FNV hashing on the message key:
Each shard is a separate .db file in WAL mode with a single writer connection and a configurable pool of reader connections.

Retention

Data older than the retention duration is periodically deleted:
When tiered storage is disabled, deleted data is permanently lost. Set retention based on your downstream query needs.

Tiered Storage (Optional)

When enabled, LiteJoin compacts expired data into Parquet files before deleting from SQLite. These files are queryable via an embedded DuckDB instance and can optionally be uploaded to cloud storage.

How It Works

  1. Retention fires — rows older than the TTL are eligible for compaction.
  2. Compactor reads rows from SQLite, writes them to Parquet files with Snappy compression.
  3. Rows are deleted from SQLite, reclaiming space.
  4. DuckDB queries Parquet files for historical data.
  5. Uploader (optional) copies Parquet files to S3/GCS/Azure Blob Storage.

Configuration

Archive Config Reference

Cloud Config Reference

Data Lifecycle Example

Given retention: 1h and archive.local_retention: 168h:

Querying Historical Data

Historical data is queryable via the Snapshot API. When a from parameter extends beyond the retention window, the snapshot handler automatically queries Parquet files via DuckDB.
The hot path (real-time joins) has zero overhead from tiered storage. DuckDB is only used for historical queries.