News for hackers. Stuff that matters.
Re:Complexity is a source of income in open source ecosystem... by osalberger on Monday May 24, 2021 @02:46PM (#27268166)
The thing is that SQL was originally built to be an easy accessible DSL for simple database queries, and was not intended to be used to build highly complex stuff. Datalog-like query languages would do the latter much better since they are actually capable of letting you write reusable predicates and libraries for common usecases, while SQL easily grows into a monolithic monster.

Sadly a lot of the "NoSQL" hype later on was led by people who had no clue about database theory, and proceeded to throw the baby out with the bathwater and build whatever abomination MongoDB is, rather than taking SQL's theoretical basis and building a language on top of it that is actually designed for complex usecases. There were only a few exceptions like say Datomic in Clojure world that did NoSQL right.

Re:Complexity is a source of income in open source ecosystem... by whalesalad on Monday May 24, 2021 @02:48PM (#27268211)
This is unrelated to SQL. We are using SQL as examples - but it is not important to the argument.
Re:Complexity is a source of income in open source ecosystem... by jklowden on Monday May 24, 2021 @06:47PM (#27270584)
IBM did not spend the money it did to replace its premier database product, IMS, with another DBMS, DB2, just to enable "simple database queries". Yes, SQL was influenced by other "4th generation languages" of the era. But IBM judged -- correctly, on the evidence -- that most programmers would not take the time to master first order predicate logic or set theory.

So they came up with something that implemented the Relational Model in a simple way, one that would attract new converts. SQL has plenty of warts and defects, but its success at extinguishing every other database query language can't be denied.

Re:Complexity is a source of income in open source ecosystem... by osalberger on Tuesday May 25, 2021 @12:00PM (#27278520)
Datalog isn't especially difficult to learn though, and is intuitive enough that you can fully learn it in 20 minutes.

The relational model with unions of conjunctive queries at its core is excellent. SQL on the other hand feels like some weird COBOL dialect that gives you an incredibly verbose implementation of it.

With that said, there are a few enterprisey NoSQL databases which are relational yet provide a nicer language to work with than SQL. I mentioned datomic (which also has persistence as its key feature), but there's also TypeDB which lets you use the first class support for recursive queries to support inheritance more easily. And of course there's google's Logica language which compiles to SQL and lets you use datalog syntax and the ability to write reusable queries, though it doesn't support recursion due to the nature of its target.