4 ms·
> we’ve currently fallen back to interval based polling to refetch queries. This fancy "subscribe to events when the results of this query change" system boil
by londons_explore 7y ago
> we’ve currently fallen back to interval based polling to refetch queries.
This fancy "subscribe to events when the results of this query change" system boils down to just polling the database...
- aidos 7y agoSometimes the simple option is the best. Having said that, it’s not that simple, for them. I believe it relies on being able to fetch and dissect different results for different clients in the same query (all while applying their own form of RLS).
- GorgeRonde 7y agoFuture work: Reduce load on Postgres by: - Mapping events to active live queries - Incremental computation of result set Fake it till you make it. Meanwhile: https://opensource.janestreet.com/incremental/ https://opensource.janestreet.com/incremental/
- aidos 7y agoI’m not entirely sure how the library you posted is related. Because it does incremental computation? It doesn’t seem to have anything to do with Postgres. As far as I can tell it looks more like mobx.
- GorgeRonde 7y agoThey built other libraries on top of this [1] [2], and when compared to mobx [3] it indeed looks very similar, however I think the target ideal of having a small core on top of which one would build more complex computation is essential. Since Clojure is pervasively built on laziness, there has been some discussions in the community about doing the same but for incremental computation. And doing it pervasively most importantly guarantees it will work at any granularity without any manual fiddling with observables and reactions. A recent contribution to the solution field in Clojure is micro_adapton [4][5] which looks like it is to incremental computing what miniKanren is to logic programming, i.e. a tiny core for a a challenging problem. Also, considering the literature around it it seems to be pretty tricky to do properly, especially when it comes to databases [6]. [1] https://github.com/janestreet/incr_map https://github.com/janestreet/incr_map [2] https://github.com/janestreet/incr_select https://github.com/janestreet/incr_select [3] https://github.com/mobxjs/mobx https://github.com/mobxjs/mobx [4] https://github.com/aibrahim/micro_adapton https://github.com/aibrahim/micro_adapton [5] https://arxiv.org/abs/1609.05337 https://arxiv.org/abs/1609.05337 [6] https://scholar.google.fr/scholar?hl=fr&as_sdt=0%2C5&q=incremental+computation+database&btnG= https://scholar.google.fr/scholar?hl=fr&as_sdt=0%2C5&q=incre...
- village-idiot 7y ago> Since Clojure is pervasively built on laziness Only some of Clonure’s data structures are built on laziness, everything else in the language is strict. If you want something actually built on laziness, you need Haskell.
- josephg 7y agoYep. I’d love to see an implementation of this in the wild built on top of logical decoding: https://www.postgresql.org/docs/9.6/logicaldecoding-explanation.html https://www.postgresql.org/docs/9.6/logicaldecoding-explanat...
- ZitchDog 7y agoInteresting idea. Logical encoding would give you the updated row, but how would you check it against each query to see if the query needed to be rerun? Sounds tricky.
- Liron 7y agoMe too. Here are my thoughts on the current state of "realtime databases": https://hackernoon.com/why-eve-will-be-perfect-for-realtime-apps-92b965b80ad https://hackernoon.com/why-eve-will-be-perfect-for-realtime-...