← Sunday, October 4, 2026DatabasesGuide

Two stacks support sliding-window aggregation without an inverse

orlp.net 6 min read Editor score 7/10

The piece introduces a two-stack approach for repeated window summaries such as minima, quantiles, and approximate unique counts, where removing an item cannot be handled by an inverse. This is a useful pattern for streaming and telemetry systems.

What
A two-stack algorithm maintains sliding-window aggregates for associative operators that have no inverse.
How
It generalizes aggregation with empty(), unit(), combine(), and finalize(); the simpler two-stack method is amortized O(1).
Why it matters
It supports summaries such as minimum, quantile, and approximate unique count, avoiding failures from inverse-based updates such as NaN persisting after it leaves a window.

Discussion

Discussion is not switched on yet. Use Note above to keep your own thoughts on this story.

Headline, summary, brief and diagram are written by a model from the source's own text; the link, byline and numbers come from the source. Read the original before relying on a claim.

Your note

Private to you. Stored in this browser, and synced to your account when you are signed in.