Docs Why HeapDB

Why not Postgres, Redis or your own code?

You can write time-aware ranking in SQL or application code. HeapDB packages the parts that are tedious to get right and keep right.

You can write this in SQL or application code, and for a one-off you should. We built HeapDB for everything after the one-off. It packages the parts that are tedious to get right and keep right: ordering that survives decay, a top-k that does not score everything, learning from answers, and reasons for each result.

What HeapDB packages

You needIn Postgres, Redis or app codeWhat HeapDB packages
Ordering under decayRecompute every score with now() on each query, or rewrite stored scores as time passes.Forward-decay keys: order is fixed at insert and never needs rescoring.
Lag-aware top-kScore every row in the window, then sort.Lag kernels per effect plus segment upper bounds; stops once the k-th best beats every remaining bound.
Learning from answersA feedback table and hand-written weight updates.Beta links with proportional credit, joint causes and priors shared across entities.
Why this answerAd hoc logging.EXPLAIN on every answer: lag, kernel value, link counts, dose, rules.
Are scores trustworthy?Unmeasured.Calibration report: predicted score against observed confirm rate, with a Brier score.

We explain how each part works in Core algorithms (forward decay, segment pruning) and Learning and EXPLAIN. For speed, read Benchmarks: the Rust engine is faster than SQLite and PostgreSQL at every size we measured (16× faster than SQLite at p50 on 1M events), and the page shows where segment pruning pays off.

What HeapDB is built for

  • Questions where several candidates are plausible and timing, features and history together decide the order: which change caused an error spike, what came before a churn, which memory helps this turn.
  • Workloads with a feedback signal (reverts, postmortems, confirmations, memories an agent used), so the ranking improves with use.
  • A shortlist with evidence that tells you where to look first.
  • Durable storage when you need it: heapdb-server keeps a write-ahead log and snapshots on local disk or S3.

Use it alongside

  • Postgres and your warehouse for records, joins and reporting.
  • Your vector store for similarity search.
  • Experiments and bisection when you need to prove a cause; HeapDB tells you which candidates to test first.

More in Design scope.