Hacker News new | ask | show | jobs
by evgskv 583 days ago
In my opinion any analytical query is easier to read in logic language than in SQL. But it's most obvious for recrusive querries. E.g. distance in graph defined by predicate (aka table) G written in Logica looke like:

  D(a, b) Min= 1 :- G(a, b);       # Connected by an edge => distance 1.
  D(a, c) Min= D(a, b) + D(b, c);  # Triangle inequality.
 
It will be much harder to read with SQL CTE. It can also computed over weighted graphs, which is impossible or extremely hard with SQL.

In practice you rarely need recursive querries, so gap between Logica and SQL isn't as large as it is here, but Logica is easier to read (in my opinion) for similar reasons.