HN user

RedCrowbar

437 karma

Co-founder and CTO of Gel Data [1], asyncpg maintainer

[1] https://geldata.com

[ my public key: https://keybase.io/elprans; my proof: https://keybase.io/elprans/sigs/p0bjVrvsPB2J-0pE_ZgpeT-gli6jsZ45wHgeBaMKNNY ]

Posts3
Comments155
View on HN

The paper seems to mostly focus on the quality of cardinality estimation (mostly driven by statistics) which is admittedly one of the frequent sore points in Postgres. There's been some progress in that area though (CREATE STATISTICS being a highlight).

(article author here)

If I use some other extension like timescale is that compatible with gel [...] Postgres is so powerful partly because of its ecosystem, so I want to know how much of that ecosystem is still useable if I’m using gel on top of Postgres

Playing nice with the ecosystem is the goal. We started off with more of a walled garden, but with 6.0 a lot of those walls came down with direct SQL support and support for standalone extensions [1]. There is a blog post coming about this specifically tomorrow (I think).

And is there a story for replication

Replication/failover works out of the box.

subscribing to queries for real time updates?

Working on it.

so can I add gel to an existing Postgres instance and get the benefits of the nicer query language or does it rely on special tables?

Gel is built around its schema, so you will need to import your SQL schema. After that you can query things with EdgeQL (or SQL/ORM as before).

[1] https://github.com/geldata/gel-postgis

If your database client is any good, it should do the retries for you. EdgeDB uses serializable isolation (as the only option), and all our bindings are coded to retry on transaction serialization errors by default.

Transaction deadlocks are another common issue that is triggered by concurrent transactions even at lower levels and should be retried also.

EdgeDB 3.0 3 years ago

Can EdgeDB solve the problems like `soft-delete`?

Yes, with access policy rules. E.g

   global hide_deleted: bool;

   type SoftDeletable {
     deleted: bool;

     access policy hide_deleted
       allow all
       when (global hide_deleted)
       using (not .deleted);
   }
The above will effectively "hide" objects with `.deleted` set to `true` from all queries when the `hide_deleted` global is set to true.

How about hooks, for example, I want to trigger scripts after/before a record is added to the table.

EdgeDB supports triggers: https://www.edgedb.com/docs/changelog/3_x#triggers. Future versions will add support for causing effects outside of the database, e.g. call a WebHook or some such.

EdgeDB 3.0 3 years ago

No plans for that yet. We feel EdgeQL is a far superior choice for the intended use case of application development.

EdgeDB 3.0 3 years ago

Yes, although rewrites are fairly minimal. Mostly limited to name mangling.

EdgeDB 3.0 3 years ago

Yes, we are looking into possibly supporting in-place upgrades in future releases.

EdgeDB 2.0 4 years ago

EdgeDB does not use Postgres RLS, access rules are injected into every query by the query compiler instead. This side-steps the RLS gotchas and limitations (RLS does not allow aggregates in rules, EdgeDB does), but also yields somewhat better query performance.

EdgeDB 2.0 4 years ago

With the addition of `GROUP` in 2.0, EdgeDB is as suitable for OLAP as vanilla Postgres is (unless you absolutely need window functions, which we don't implement yet).

EdgeDB 2.0 4 years ago

EdgeDB is very particular about how the underlying data is organized, so you can't put it in front of an existing database. Importing schemas and data is another story which we're working on.

EdgeDB 2.0 4 years ago

Only the query compiler is in pure Python and you only hit that once per query, as the compilation result is trivially cached. The hot path is a combination of Cython, C and Rust. We have a suite of benchmarks [1] that show relative overhead of EdgeDB compared to raw Postgres is quite low.

[1] https://github.com/edgedb/imdbench

EdgeDB 2.0 4 years ago

I think the OP meant `NOT NULL` as in nullness check in queries. EdgeQL uses `exists <foo>` to check for existence of data. We have examples in the cheatsheet and elsewhere but it's probably hard to find if you're looking for "NOT NULL" specifically. We'll see about a way to improve the discoverability of this.

EdgeDB 2.0 4 years ago

Yes, we'll be adding a way to choose the index type. It's even more relevant now that we've exposed range types.

EdgeDB 2.0 4 years ago

You can run the server in foreground [1] with `env EDGEDB_DEBUG_EDGEQL_COMPILE_SQL_TEXT=1` and observe emitted SQL.

[1] edgedb instance start --auto-restart --foreground -I <your instance>

EdgeDB 2.0 4 years ago

Postgres does have a very elaborate extension system, but it's unsuitable for something like EdgeDB, because we are fundamentally altering the database interface: EdgeQL vs SQL and a different client/server protocol.

EdgeDB 2.0 4 years ago

That `sys::TransactionIsolation` doc is outdated, EdgeDB only supports the `Serializable` transaction isolation. See related discussion [1]

At this point EdgeDB supports Postgres HA passively, i.e. it will react to a failover event in your cluster via one of the documented mechanisms. Support for "active" cluster management is a planned feature too.

Finally, EdgeDB server itself is fully stateless and you can run multiple instances of it in front of the same Postgres cluster. Admittedly, we need to document this better.

[1] https://github.com/edgedb/edgedb/discussions/3466