ivm
SQL views that stay correct by applying only what changed.
An embeddable Incremental View Maintenance engine. Declare a SQL view once, mutate the base tables, and the view stays correct by applying only the deltas, never recomputing. It implements the DBSP model, where every row carries a signed weight (insert +1, delete −1), so what streaming databases run as a separate service becomes an importable library.
livelast push CI passing ·
Project Telemetry
Updates / sec
37K
p99 latency
43 µs
vs recompute
≈3,600×
Oracle tests
570
Run it in your browser
A pocket version of the engine. Change the base table and the view is patched by that one row's ±1 weight, then checked against a full recompute.
SELECT region, COUNT(*), SUM(amount), MIN(amount) FROM sales GROUP BY region
| id | region | amount | delete |
|---|---|---|---|
| 1 | north | 42 | |
| 2 | south | 25 | |
| 3 | east | 12 | |
| 4 | north | 18 | |
| 5 | south | 40 | |
| 6 | east | 33 |
| region | count | sum | min |
|---|---|---|---|
| east | 2 | 45 | 12 |
| north | 2 | 60 | 18 |
| south | 2 | 65 | 25 |
Insert or delete a row. Each change is one signed delta, applied to one group.
How it works
~/ivm/architecture · step 1/4
01
base-table mutations
02
Z-set deltas (±1)
03
operator graph
04
join / aggregate state
05
view deltas
06
oracle check

