I am extremely happy that people are actually thinking about the real problems with SQL (not the MongoDB-inspired ones). I am going to monitor progress here, because I have long lamented the badness of SQL.
I’ve always wondered what an RDBMS (good) would look like without SQL (flawed) - maybe it’d be more like QUEL…
If you find this interesting, you absolutely should read The Third Manifesto (PDF Warning).
It is an attempt to put relational database languages on a firm, type-safe basis while still leveraging the power of the relational algebra. It’s also just a really fun read.
EdgeDB/EdgeQL conforms to many (but not all) of the D proscriptions.
1st1 says in their profile that they’re an EdgeDB employee. Are you?
Yes, he’s EdgeDB co-founder and the author of the linked blog post.
Ok, thanks. Just like to be sure about that when I’m reading articles about products and related tech. This is a good one. Welcome to Lobsters to the both of you. :)
Thank you! :)
Python is an unusual choice for a database. Do you not expect latency/performance to be an issue?
We’ve managed to squeeze a lot of performance out of Python and there are ways to do way more. Python has been amazing at allowing us to iterate quickly. That said, the current plan is to slowly start rewriting critical parts in Rust.
Any plans for a Rust language interface? I have a medium sized database-oriented project in Rust and it would be cool to try rewriting part of it for EdgeDB.
Not yet. Maybe you want to help us implement it? :)
I would love to, in my Copious Free Time. …of which I have none. It’s very tempting though.
Sounds good, thanks for the insight :)
We’ve posted some initial benchmarks here: https://edgedb.com/blog/edgedb-1-0-alpha-1/
Could you elaborate?
No mention of datalog, which has been applied very successfully in Datomic?
Dedalus is another datalog project, introduced in this very Interesting talk:
I’m curious, have you had success with Datomic in production? IME “successful” is not the appropriate adjective, not that that is a reflection on datalog itself.
Really interesting article, and really interesting project, looking forward to try it out! On a completely off topic point, I wish languages had support for custom strings like raw strings, regex strings but for queries, etc. For example:
q = [SQL]"""
SELECT * FROM table;
so that editors can actually highlight the text in the proper colors, and so that we can static check the queries.
It also lets you introspect the string at runtime. Doing it at compile time also seems possible as long as the interpolations is “well behaved”.
I don’t know if this has been implemented for SQL, but this should be possible in Rust with macros. Similar things have been done - see typed-html for example.
This is really interesting, I’ve seen the project before and I was quite surprised by it, though I was thinking of something a bit more cross language like SQL queries with proper SQL syntax. It could be also interesting for code templates generation.
q = [[
SELECT f1,f2,f3 FROM table
WHERE status = 1;
You lose the traditional characters escapes like ‘\n’ though. Syntax highlighting might be a trick, but the editor could look for a comment like:
q = --[[ SQL ]] [[
SELECT f1 ...
This is really cool. I’ve never used Lua, but that’s more or less what I wanted.
To all interested, here’s a blog post about first alpha release of EdgeDB: https://edgedb.com/blog/edgedb-1-0-alpha-1
It contains benchmarks against Django, SQLAlchemy, MongoDB, and handwritten SQL queries.
graphql-meets-protobuf, built on top of postgres. No thanks.
… that sounds kinda good to me. Why don’t you like it?
yeah that comment actually made me go read the article :)
The major theme I see is that in SQL, once you’ve got one part of the expression worked out, it’s not necessarily going to be a direct subexpression of the larger query you’re trying to construct. This can be described as composition by juxtaposition, and it’s valuable. SQL missed the trick on this one, so it’s not a surprise that many SQL replacements focus on this (directly or indirectly).
q/kdb is worth looking at since it has this feature too. Consider:
select name,(exec deptno!name from emp where role=`dept_head)no from dept
select avg x from select x:count i by description from reviews
select avg x, max x from select x:count i by description from reviews
You want views? You’ve got them:
s::select x:count i by description from reviews
select avg x, max x from s
Nested trees? Nested data!
select description, (select[>last_name] first_name, image from directors),
(select[>last_name] first_name, image from cast),
(select[>creation_time] body,rating,(select name, image) from author from reviews)
Piece of cake! q/kdb supports tables (and dictionaries) as regular data types, including nested in a column. No need to join anything if your data is already the right shape!
The article makes some good points. The database itself is apparently built on PostgreSQL, so maybe there’s a chance to get a EdgeQL->SQL compiler out of this?
Source repository here: https://github.com/edgedb/edgedb It turns out this is built in python, properly embedding postgresql.
so maybe there’s a chance to get a EdgeQL->SQL compiler out of this?
so maybe there’s a chance to get a EdgeQL->SQL compiler out of this?
There’s a compiler inside EdgeDB but there are no plans on offering a standalone version of it. The reason is that EdgeDB has a lot more layers than just that compiler, i.e. the data model and schema are different from SQL. If you like EdgeQL, the only way to try it (currently) is to use EdgeDB.
This looks quite interesting. The language looks like a strange mix between SQL and JSON, but somehow I’m having some trouble convincing myself that this really is more composable than SQL.
I’d say it’s closer to GraphQL, although it is way more powerful. Perhaps this documentation page can tell you more about composition: https://edgedb.com/docs/edgeql/expressions/shapes
I’m impressed by the amount of thought (and work) that went into this. I think the decision to make your own client library for Postgres was probably the right one. Binding libpq brings lots of advantages out of the box, like automatic parsing of .pgpass, environment variables and so on, but it looks like even these things have been re-implemented. Really cool!
Dammit, now I’m all excited :) Now I’m going to have to consider if I want to make a CHICKEN binary Postgres protocol implementation :) It looks like the “automatic” parsing of composite objects you get “for free” is a killer feature. I’ve always thought mapping custom types from the db to types in the programming language is extremely powerful and not used enough. And the performance benefits of not having to parse text (and serialize it on the server) are the cherry on top.
Thank you for this inspiring stuff!
Yes, we can do better than SQL. I’m glad people are actually doing so now. :-)
What is the monetization scheme here? Is it another elasticsearch/mongodb?
It’s a bit too early to talk about monetization, but the database itself is fully open source under Apache 2.
I think many companies made this “too early to talk about monetization” mistake. I wish you figure it out.
The greediest reptilian capitalists will worry about license management and the neckbeardiest freetards will be offended at having to pay, but demanding users to switch - for ostensibly only syntax - is a loss only to the company itself.
If you have employees, you need monetization. If you have secret plans, feel free to ignore this comment. Otherwise, consider a prohibitive license like the AGPL on the spec and a permissive license like MIT for the code. Since you are the same group developing both, you get to license things how you please. Then sell support, and negotiate for royalties with paid databases in exchange for them using your language.
For those of us who cannot use a package manager to install the package, yet want to use the directory structure to cast the package into something useful (think ArchLinux and pacman), it would be nice to be able to download the .deb or .rpm directly instead of meeting a “403 Forbidden”.
Yes, I’ll look into enabling autoindex there. Meanwhile, here’s a direct link to the RPM package: https://packages.edgedb.com/rpm/el7/edgedb-1-alpha1-1.0a1-3.el7.x86_64.rpm