Multi join aggregation performance #7506
-
Hi! I wanted to play around EdgeDB, and especially to compare it's performances to postgres. I wrote a blog post months ago that explained how to improve on a naive multi join aggregation (https://blog.kagamino.dev/posts/postgres-aggregates/), so I wanted to see if EdgeDB was up to the task. This is what I used for my test schema:
data generation:
Then I tried to measure this query: So my question: is there a better way to write this query in EdgeDB, so that it would run faster? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You're using many-to-many links in EdgeDB ( |
Beta Was this translation helpful? Give feedback.
You're using many-to-many links in EdgeDB (
multi
link withoutcontraint exclusive
), while you're using one-to-many links in SQL. EdgeDB implicitly creates a join-table formulti
links. I'd change the schema to use asingle
link from review/order to product, and a computed backlink for ease of use.