Conversation
| r.id as review_id, | ||
| r.body as review_body, | ||
| r.rating as review_rating, | ||
| json_build_object( |
There was a problem hiding this comment.
Other implementations aren't using in-database JSON encoding, so this wouldn't be a fair comparison of binding performance. See also #48 (comment)
There was a problem hiding this comment.
Is postgres.js capable of decoding arrays and tuples? If so, I'd use the asyncpg queries for fairness.
There was a problem hiding this comment.
@elprans it does arrays but not record tuples. I did do a query assembling things in the client just like the go example, but it didn't do any performance difference (i actually think it was a bit faster). In my opinion I think using json in the query is more fair, since PostgreSQL can do so much more - so if you want to honestly compare eg EdgeDB queries to PostgreSQL - choose the best from both worlds. I can change it to match the go query or asyncpg, but I think it would make more sense to maybe change them to use this query instead? I might be biased since I want to stay as close to the "native" queries as possible, which I guess is also part of your reasons for making EdgeDB?
There was a problem hiding this comment.
The issue is that JSON strips rich type information, e.g. instead of a proper Date object for a timestamp column, you get a string, etc, which is significantly less useful for application code. This isn't entirely obvious here, because the current benchmark code just serializes things back to JSON, but it's an important aspect nonetheless.
There was a problem hiding this comment.
We can add a variation of each query that returns JSON directly, if supported. In fact, EdgeDB explicitly supports database-side JSON encoding of results of arbitrary queries.
Hi. Here's an initial shot at adding Postgres.js to the sql benchmarks. I've only implemented the 3 cases tested in the run for now.
By the way - awesome job on EdgeDB, I'm looking forward to have time to give it a closer look! I think it would be really cool to have a Postgres.js style surface api for the EdgeDB javascript (node/deno) driver
fixes #44