4 ms·
I learned datalog through Crux and I really enjoyed it. After not very long, it was more intuitive and easier to reason about that similar sql.
by wry_discontent 6y ago
I learned datalog through Crux and I really enjoyed it. After not very long, it was more intuitive and easier to reason about that similar sql.
- slifin 6y agoI'm trying to learn datalog casually, there's lots of queries that I still don't know how they translate I.e. group by, window aggregates, order by, limit I'd be interested in seeing the equivalent datalog that Crux makes given some of those statements for learning what efficient datalog looks like for some of those problems
- refset 6y agoYou always have the option to wire together multiple Datalog queries using Clojure/JVM-lang-of-choice (the N+1 query problem doesn't affect Crux when embedded), but we are currently analysing the possibilities for a higher-level query API, potentially in a similar vein to Mongo's pipelines [0], where a sequence of "stages" is defined. In the ideal case there would be _closure_ in the intermediate steps of a pipeline such that the output to any given stage (including Datalog queries) is a fully-fledged graph in its own right. As for your specific examples, Crux already implements an order-by+limit+offset combination that automatically spills to disk if needed, but for efficient pagination you would probably want to maintain additional pre-sorted value ranges. For basic aggregation we have an alpha API decorator that composes Clojure transducers to great effect [1]. [0] https://docs.mongodb.com/manual/reference/operator/aggregation-pipeline/ https://docs.mongodb.com/manual/reference/operator/aggregati... [1] https://github.com/crux-labs/crux-decorators/blob/master/test/crux/aggregation_test.clj https://github.com/crux-labs/crux-decorators/blob/master/tes...
- fnordsensei 6y agoI highly recommend http://www.learndatalogtoday.org/ http://www.learndatalogtoday.org/ as a learning resource. I also enjoyed this talk: https://youtu.be/oo-7mN9WXTw https://youtu.be/oo-7mN9WXTw though it’s not so much about syntax as the logic of it.
- capableweb 6y agoJust finished watching that talk, I recommend it too! Information dense and fast with lots of useful examples on how to use Datalog, especially comparing it to what most programmers use today such as relational, key/value and document stores.