SQLite Forum

Best way to observe database operations
> initial: {a: 2}... diff: {update: {a: 2.5}}

Sure, but who computes the "update" node, and from what data?

No matter what, for this particular case, *someone* has to do a full table scan each time an update is needed.

It's likely less efficient to do it on the producer side anyway. If the DB is being updated 100 times a second, you don't want 100 "update" events in the DB per second computed from a table scan per, you want ~33 new rows added per third of a second with one table scan per made on the consuming side.

> ...the web...mutate the smallest number of nodes.

That's an inapt comparison.

A web server is typically 10-20 ms away, so anything you can do to reduce the number of round trips, you should absolutely do.

Your SQLite DBMS is orders of magnitude closer to your code. With sufficient RAM and an SSD to back it, I'd expect at least 3 orders of magnitude improvement for equivalent work.


> ...keep the unchanged portion immutable.

Laudable in principle, but only worth doing if it's actually a net improvement, all things considered.

Part of "all things" is developer time.