SQLite Forum

Best way to observe database operations
Login
I meant computing the difference between two queries. 

So the first time you run a query that populates the view initially.

Subsequent changes only update the part of the view that changed.

In the `select avg(n) from data` case:

- initial: `{a: 2}`
- diff: `{update: {a: 2.5}}`
- diff ...
- diff ...

I am thinking of views in terms of how they work on the web - you have a tree-like document. When your data changes you mutate the smallest number of nodes.

So its like using https://en.wikipedia.org/wiki/Copy-on-write for both the view and the JSON-like structure in your language. If you have a diff event stream you can update only what has changed and keep the unchanged portion immutable.

I think you're using the view model where you paint every pixel on the canvas, which means re-generating 100% of the frame.