EdgeQL, the query language of EdgeDB, is a very interesting piece of tech. It's a new, strictly typed query language, that aims to surpass SQL in querying power. Functional in its nature it was designed to be composable and easy to learn. Happy to answer any kind of questions.
Wow, EdgeQL looks amazing! I've spent a good amount of time looking into SQL alternatives and building my own, and this is the only one that feels like "I must try this!" (Too bad my current project has no need for a DB; now I have a dilemma...)
> You can run EdgeDB as a query engine on top of an externally hosted Postgres instance or let EdgeDB manage Postgres for you under the hood.
This is excellent. Allows me to use EdgeDB for the majority of my application, but still treat it as a "plain old Postgres DB" when needed.
I found EdgeDB today via the article "Against SQL" (which triggered so many pain points), and now rewriting one of the projects to use it. I know it's not production ready, but it looks too good not to try.
I'm a SQL newbie so maybe I lack context for this decision, but why did you decide to keep the "SELECT" keyword? Going through your tutorial, SELECT seems redundant and could just be dropped without any loss of information. In that way look a lot more like most non-SQL languages. Why do I need to SELECT "string" instead of just "string"?
I'm trying to understand how this tutorial works, I noticed it doesn't make any network requests when run one of the examples, but then if I edit the code in an example it does make a request. Is this the magic of next.js and server-side components at work, and do you have a real edgedb running on the server side that is used to pre-render the page and also handle updates? I would love to hear more about how this setup works and even look at the code if it's available.
If there is one piece of techno I have my eyes on since some time, and am the most exited about, it’s EdgeDB.
You guys have nothing to prove anymore. I’m using your work on a daily basis: asynpcg, uvloop, black and … python !
When I came across the EdgeDB project, I thought: “damn it’s too good on the paper to be true”. And when I watched the 6th video of “import asyncio” from Łukasz on your YouTube channel, it blew my mind the kind of queries one could achieve, and how flexible was the schema definition with the abstract types.
Although I’ll have to be a bit more patient to push this techno at work, I’m even orienting my personal projects to be a fit for edgedb usage.
Do you have any simple mechanism for bulk import, either from CSV or JSON files, or existing Postgres? Googled a bit and didn't see how to bulk load an existing dataset.
There aren't any special "bulk" interfaces at the moment, you can load data via a small program using our language bindings (INSERT in a loop). We'll add support for batched `executemany()` soon to cater to very large loads specifically. A similar optimization in asyncpg [1] led to a 10x improvement in throughput (~100Krec/sec per connection), and we expect similar performance from EdgeDB once the protocol and the bindings are updated.
Loading arbitrary JSON by introspecting the data, and auto-generating the schema and the necessary DML statements is fairly straightforward too. I have a rough Python proof-of-concept, will need to find time to finish and publish it.
We've spent years in R&D mode working on the data model, the query language, APIs and architecture to make sure that everything clicks together to create one vertically integrated, cohesive, and language agnostic solution. Everything in EdgeDB is optimized for DX (while not sacrificing perf or type safety), and as far as I know there's no other database company out there which does what we do. So fingers crossed, our attempt at evolving relational databases will be successful.
I'm not intimately familiar with that particular piece of history, unfortunately (I'll read more about it for sure). There were many examples in the past of great tech (like smalltalk or network dbs) that didn't exactly succeed for many reasons, sometimes because it was created way ahead of its time. We build EdgeDB to address today's needs: nested hierarchical queries, integrated schema migrations, performance, high quality language drivers etc. There is some intersection with what was done in the past for sure, but if you're interested in databases I encourage you to take a look at our website, the blog, and the docs. I'm sure you'll find new things.
It handles them just fine. Any single EdgeQL query always compiles to just one SQL query under the hood. We wrap nested hierarchy levels subqueries in array_agg and our binary protocol is designed in such a way that unpacking the results is very fast.
Question: why do you claim EdgeDB is a "relational" database when you can't actually do relational algebra with it? How do you join?
Materialized edges (i.e. what you call "links") are not part of any relational model, it's a part of the graph model. You seem to have implemented a graph database, but possibly without the graph walking capabilities of graph databases.
EdgeQL lets you do arbitrary joins as well. Here's how you could compute salaries of employees by department even if you for some reason don't have a link between Employee and Department:
SELECT (Photo {uri}, User {name, email})
FILTER Photo.author.id = User.id;
The tutorial database uses links, and so instead of having an author_id we have author.id, but having an author_id property would work just fine---except that then you'd have to do all the joins manually.
```
WITH
P := Person
SELECT Person {
id,
full_name,
same_last_name := (
SELECT P {
id,
full_name,
}
FILTER
# same last name
P.last_name = Person.last_name
AND
# not the same person
P != Person
),
}
FILTER EXISTS .same_last_name
```
There are a few reasons why RethinkDB failed; there's an excellent blog post written by the founder. I think there are many areas where we are quite different:
- We are building on top of Postgres, so we are not investing too much time into the hardest technical problems like creating robust DB storage and query planning/execution engines.
- Instead we focus our time on designing proper high level APIs, the EdgeQL language, migrations, and the DX.
- Yet still, EdgeDB is a relational DB; it's strictly typed and fast. Which is still what the majority of companies want.
> Also will it handle large scale deployment with Fail-Over and Replication?
Built-in support for that is coming, but it's already possible to run EdgeDB on top of Amazon RDS, for example. Ultimately EdgeDB is built on top of Postgres, so it will support replication and fail-over and many of the existing deployment strategies.
For me to use EdgeDB with RDS I would need to compile it [1]. But I don't think this is recommended usage of EdgeDB and there isn't enough documentation on using EdgeDB with an external postgres instance.
I see that I could use:
edb server --postgres-dsn
But I guess you'll release more docs on using EdgeDB with external instances soon, maybe before 1.0 release.
edb server is mostly a development-mode proxy to edgedb-server, which is the actual server binary and supports the same options. The Docker image README [1] has some documentation on the supported options.
Do you ever intend to replace it with a custom backend? Just asking due to the article yesterday that said the only way to start is with an abstraction over an existing RDBMS, but could potentially evolve later.
We plan to release 1.0 in a month or two. The upcoming beta 3 (in 1-2 weeks) will be the last beta before the RC.
That said, EdgeDB is already stable and solid thanks to the amazing Postgres that we're building it on top of. It's definitely ready now to play with and learn.
What I really like about Prisma et al is that they provide me with a native client. I don’t have to think about my queries as strings, I have autocomplete for everything that can possibly be part of the select/delete/update (in typescript at least).
Now that I’ve gone there I don’t think I can go back, even if this looks otherwise amazing.
Agreed, Prisma with TS is really nice. I’ve recently been using Blitz, which integrates Prisma and Zod (amongst other things) and it feels like so much of the old webapp plumbing is either now gone or is practically writing itself through autocomplete.
Yeah, Blitz does feel beta-y, in a true sense: a few things are still being polished, but it’s pretty stable and v1 seems to be close to done.
I’ve only been using it for a personal project, but since the fix for the Material UI recipe (which I think was actually related to an npm behavior) I haven’t run into a single bug.
I suspect that’s because it seems like a lot of Blitz is unifying some really good established libraries into a framework. It’s not written from the ground up.
Ok, this comes at a right time.. I was just starting a new project and considering Neo4j. I think it is unfair to compare it to Postgres but the EdgeQL make it look like the nested queries are easy to execute and comes with graphql support too.
SO are there any pointers to how much production ready it is?
How does it compare to raw SQL queries and nested queries?
thanks.
Also could not find much on authentication and authorizations. are there any pointers/
EdgeDB is very close to be production ready. We will release 1.0 in a month or two and we're based on Postgres, so the hardest part of storing the data reliably is there already.
EdgeQL queries are typically way shorter than corresponding SQL equivalents. You can see comparisons and benchmarks here in this blog post: https://www.edgedb.com/blog/edgedb-1-0-alpha-1
Authentication currently is very basic. We plan to have a relatively short release cycle, so in 3-4 months after 1.0 we'll have more robust access control, including read/write policies of individual types and their properties/links.
> The easiest and preferred way to install and set up the EdgeDB server is using our command-line tool.
On the main page. I wish devs stopped giving command line instructions that execute remote bash scripts without any way to look at what's happening under the hood. It's a recipe for disaster, and really, really bad practice.
Everything is open source and we explain what the command will do. And on the Install page there are manual installation instructions + we have a docker image. How else can we improve things?
Yes, we contributed a few patches and bug reports over the years. We are using vanilla Postgres since it hit 12 and now contains our fixes (or fixes proposed by us).
If I were you, I would rather start with SQL. It is so pervasive that it would never be a skill you regret having. I don’t believe you would regret learning EdgeQL either, or any skill for that matter, but in terms of priority I would suggest SQL would be a safer bet and help you contextualise other querying approaches down the way.
Presumably it refers to edges in an object graph [0]. EdgeDB seems to be currently deployed as a management, schema, and graph-to-sql translation layer for PostgreSQL.
There is a difference in how large a set `array_agg` would need to process, since `LEFT JOIN` may produce a very sparse relation and NULLs still have to be scanned over.
would you be able to use EdgeQL to introspect an existing postgresql database and run queries on it?
Asking as I have a project ongoing where I don't really have the time to recreate everything in EdgeDB, but wouldn't mind spending a few hours to check how the query language works compared to SQL.
Not yet. Our CLI is written in Rust and we have crates for the protocol and other pieces, but their APIs are not stable yet. It is on our roadmap though.
You can run a normal postgres DB alongside EdgeDB. You can use a regular Postgres cluster and create your pg databases in it and at the same time point EdgeDB to the cluster
Here's a direct link to the documentation page about EdgeQL: https://www.edgedb.com/docs/edgeql/index.
EdgeQL, the query language of EdgeDB, is a very interesting piece of tech. It's a new, strictly typed query language, that aims to surpass SQL in querying power. Functional in its nature it was designed to be composable and easy to learn. Happy to answer any kind of questions.
EdgeDB itself is almost ready for its 1.0 release, stay tuned. The GH link: https://github.com/edgedb/edgedb/
// Disclaimer: I'm a co-founder & CEO.