TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Introduction to Datalog

362 pointsby jgrodziskiabout 2 years ago

14 comments

groseabout 2 years ago
Datalog is great for representing authorization rules. Check out Biscuits, which are auth tokens with Datalog embedded in them. This article is what made it &#x27;click&#x27; for me: <a href="https:&#x2F;&#x2F;www.clever-cloud.com&#x2F;blog&#x2F;engineering&#x2F;2021&#x2F;04&#x2F;15&#x2F;biscuit-tutorial&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.clever-cloud.com&#x2F;blog&#x2F;engineering&#x2F;2021&#x2F;04&#x2F;15&#x2F;bis...</a><p>I actually thought that Datalog was so cool that I went to learn Prolog and it completely changed the way I think about programming. Highly recommend trying out logic programming if you haven&#x27;t before.
评论 #34811370 未加载
wslhabout 2 years ago
In the last few months the mention of Datalog has increased, I wondered how it differed from graph databases and found a clear answer in SO [1]. I am not an incumbent but found graph databases and clause approaches interesting.<p>[1] <a href="https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;29192927&#x2F;a-graph-db-vs-a-prolog-or-minikanren" rel="nofollow">https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;29192927&#x2F;a-graph-db-vs-a...</a> (2015)
评论 #34802587 未加载
评论 #34804968 未加载
评论 #34802579 未加载
评论 #34803631 未加载
评论 #34802973 未加载
muattiyahabout 2 years ago
ICYMI, there&#x27;s an excellent interactive introduction to `datalog` that&#x27;s referenced in the article&#x27;s references.[0]<p>Last time I used `datalog` was years ago, I was developing an internal interactive tool that was used to compare different approaches to solving a certain problem at my employer. I used `datascript`[1] by way of clojurescript to store all experiment data and then interrogated the `datascript` DB via `datalog`. This is something I always remember fondly.<p>[0] <a href="https:&#x2F;&#x2F;www.learndatalogtoday.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.learndatalogtoday.org&#x2F;</a> [1] <a href="https:&#x2F;&#x2F;github.com&#x2F;tonsky&#x2F;datascript">https:&#x2F;&#x2F;github.com&#x2F;tonsky&#x2F;datascript</a>
pavlovabout 2 years ago
As mentioned in the article, Datomic is a database that uses Datalog as its query language:<p><a href="https:&#x2F;&#x2F;docs.datomic.com&#x2F;on-prem&#x2F;query&#x2F;query.html#why-datalog" rel="nofollow">https:&#x2F;&#x2F;docs.datomic.com&#x2F;on-prem&#x2F;query&#x2F;query.html#why-datalo...</a><p>(Some ten years ago worked at a startup that used Datomic. It seemed to work great, although the only queries I ever needed to add to the system were simple copy-paste hacks of existing ones, so I never got to dive into Datalog.)
评论 #34802111 未加载
samuellabout 2 years ago
A bit related, just stumbled upon Flix, a functional JVM language with Datalog contraints and (somewhat?) Go-like concurrency:<p><a href="https:&#x2F;&#x2F;flix.dev" rel="nofollow">https:&#x2F;&#x2F;flix.dev</a><p>HN Thread from 8 months ago: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=31448889" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=31448889</a>
评论 #34804343 未加载
ianpurtonabout 2 years ago
So I struggled with this.<p>I guess the intention is to be better than SQL but then I was left with &quot;under which circumstances?&quot;.<p>With that question in mind I didn&#x27;t feel the article addressed the issue.<p>The author might do better to think in terms of &quot;what burning problem are we trying to fix and how did we fix it&quot;.
评论 #34803347 未加载
评论 #34802005 未加载
评论 #34807625 未加载
评论 #34808661 未加载
评论 #34808705 未加载
评论 #34802808 未加载
评论 #34805385 未加载
评论 #34805071 未加载
评论 #34805223 未加载
评论 #34842010 未加载
评论 #34801978 未加载
z5habout 2 years ago
I’ve been using Prolog a bunch recently, and also embedded and extended MicroKanren in a project. Something I came to appreciate was that Prolog’s depth-first search, and Kanren’s lazy stream approach are good with memory even when generating&#x2F;searching through infinite solutions. It is my understanding that Datalog, on the other hand, will iteratively expand a set of data. Isn’t this a problem?
评论 #34841835 未加载
anon291about 2 years ago
Whatever language this is... This is not datalog. This looks like a particular implementation of datalog in closure.<p>Actual datalog looks like prolog.
评论 #34807847 未加载
tannhaeuserabout 2 years ago
The language discussed in TFA appears to be Datomic&#x27;s proprietary Clojure DSL, but has nothing to do with Datalog&#x2F;Prolog.
评论 #34802225 未加载
k4stabout 2 years ago
I created a datalog engine a few years back called Dr. Lojekyll: <a href="https:&#x2F;&#x2F;www.petergoodman.me&#x2F;docs&#x2F;dr-lojekyll.pdf" rel="nofollow">https:&#x2F;&#x2F;www.petergoodman.me&#x2F;docs&#x2F;dr-lojekyll.pdf</a><p>It was pretty cool; you could stream in new facts to it over time and it would incrementally and differentially update itself. The key idea was that I wanted the introduction of ground facts to be messages that the database reads (e.g. off of a message bus), and I wanted the database to be able to publish its conclusions onto the same or other message buses. I also wanted to be able to delete ground facts, which meant it could publish withdrawals of the prior-published conclusions. A lot of it was inspired by Frank McSherry&#x27;s work, although I didn&#x27;t use timely or differential dataflow. In retrospect I probably should have!<p>This particular system isn&#x27;t used anymore because we made a classic monotonicity mistake by making it the brain of a distributed system, and then having it publish and receive messages with a bunch of microservices. The internal consistency model of the datalog engine didn&#x27;t extend out to the microservices, and the possibility of feedback loops in the system meant that the whole thing could lie to itself and diverge uncontrollably! Despite this particular application of the engine being a failure, the engine itself worked quite well and I hope to one day return to datalog.<p>I think what a lot of people miss with datalog, and what becomes apparent as you use it more, is just how unpredictable many engines can be with the execution behavior of rules. This is the same problem that you have with a database, where the query planner makes a bad choice or where you lack an index, and so performance is bad. But with datalog, the composition of rules that comes so naturally also tends to compound this issue, resulting in time spent trying to chase down weird performance things and doing spooky re-ordering of your clause bodies to try to appease whatever choices the engine makes.
eunosabout 2 years ago
Huh cool, I didnt realize it come from that Michelin.
评论 #34804335 未加载
dataengineer56about 2 years ago
This is a cool concept but I&#x27;m not sure I&#x27;d fancy upskilling a team of SQL analysts to use this.
评论 #34804701 未加载
i_am_toasterabout 2 years ago
Maybe it’s just me but I find the SQL much easier to read in all the examples given.
thiago_fmabout 2 years ago
The problem with Datalog, and Clojure in general are the licenses. Terrible licenses.<p>Everything is about Rich Hickey. Apache 1.0.<p>Now that Nubank basically owns it and there&#x27;s very little progress or activity as of late, I don&#x27;t see why one would chose to use Clojure, Datalog etc.<p>Also, a lot of functional programming concepts has been since added to big programming languages like Javascript and hell, even Java has lambdas now.<p>I&#x27;m guessing that also hardcore FP people have moved on to Haskell. The ones that like LISP to Racket... and only people tied to the JVM in legacy projects are with Clojure.
评论 #34802746 未加载
评论 #34805982 未加载
评论 #34802187 未加载
评论 #34803415 未加载
评论 #34809020 未加载
评论 #34804377 未加载
评论 #34806295 未加载
评论 #34803977 未加载