9 ms·
I don't think that SQL itself is such a great language, so much that the relational database model itself is quite powerful, and transparently takes care of so
by gwd 4y ago
I don't think that SQL itself is such a great language, so much that the relational database model itself is quite powerful, and transparently takes care of so many things for you. The thing that slightly frustrates me is that databases typically have several things all intertwined:
1. Users, network transport, etc (except for SQLite)
2. The SQL language
3. The query optimizer
4. Transaction functionality
5. Persistent store functionality
If you want to write a new database language, you need to either generate all of the above functionality, or "compile" your language down to SQL. What I'd love to see is having an official intermediate layer between #2 and #3, similar to llvm and gcc's bytecodes, with a range of different language front-ends; and ideally, the ability for a language to integrate directly into their type system.
Imagine writing queries natively within Rust or Golang, knowing that the types would be checked properly by the compiler; but that the query could be executed efficiently inside the database itself.
- sagarm 4y agoSubstrait (substrait.io) is trying to be a backend independent plan representation. In practice, SQL dialects consist of a collection of functions in addition to standard operators. These functions have varying naming, functionality, and edge case behavior -- often conflicting. Papering over this is a difficult problem. From a SQL database point of view, the SQL interface is well tested and required by end users. Adding an additional, rarely used interface to get to expose the same functionality is of questionable value. Using SQL as the plan serialization works pretty well.