Earlier quoted context omitted.
Curious what you think makes it better than other examples out there? How is it different than Active Record or Prisma?
prisma appears to have a transaction problem. https://github.com/prisma/prisma/discussions/12715
PostgresJs: PostgreSQL client for Node.js and Deno
121–130 of 148 posts
Re: PostgresJs: PostgreSQL client for Node.js and Deno
#122Perhaps not as featured as OP’s but I’ve found https://pgtyped.dev/ useful. Queries are written as SQL files, and pgtyped creates typed functions you call with query parameters.
Re: PostgresJs: PostgreSQL client for Node.js and Deno
#123Earlier quoted context omitted.
It's not even close. Prisma is extremely slow. Take a look at the original IMDB benchmarks on which the Postgres.js benchmarks are done. https://github.com/edgedb/imdbench#javascript-orms-full-repo... https://porsager.github.io/imdbench/sql.html
Thanks Pier! Your comment saved me some frustration here :-D https://github.com/porsager/postgres/discussions/627#discuss...
200x :O
Re: PostgresJs: PostgreSQL client for Node.js and Deno
#124Earlier quoted context omitted.
I think the access pattern that Prisma uses (for a given records from X, give me it's relations to Y, then give me Y's nested relations to Z in a unified data model), using multiple queries may the the _best_ way (not necessarily the most efficient) to do it to produce the resulting object model. If you were to do this with joins, you'd have a ton of duplicated data returned (via returning every column from every tab…
> If you were to do this with joins, you'd have a ton of duplicated data returned (via returning every column from every table to have all the relevant data) ARRAY_AGG for Postgres or GROUP_CONCAT for MySQL does what you’re asking without duplicating rows. Re: JSON, don’t. RDBMS was not designed to store JSON; by definition you can’t even get 1st Normal Form once its involved. IMO, claims of DX regarding SQL just mea…
Re: RDBMS was not designed to store JSON https://youtube.com/watch?v=rpw_x8TtqTo
Re: PostgresJs: PostgreSQL client for Node.js and Deno
#125Have to say, if you like to do bare metal SQL, using the nice features of Postgres, working with this lib is a total Joy! No “fancy” and bleeding abstractions like something like Prisma, not convoluted type annotations like other TS libs, no, just plain SQL statements in the best JavaScript way of doing it. I discovered learning to do Postgres a couple years ago, after getting sick of trying to hack Prisma, tried out…
Re: PostgresJs: PostgreSQL client for Node.js and Deno
#126Earlier quoted context omitted.
What do you mean multiple schemas ? What is an example of a non readable type?
I didn’t know support for schemas had landed, but the docs still seem obtuse for joins and upserts. Compared to plain SQL files in PgTyped — which admittedly needs some annotations to work, and lacks transactions —, I find the lateral joins in Zapatos really verbose and ugly. Lots of extra parameters too. Which isn’t to say it’s not a great tool! You pick what you like :)
Re: PostgresJs: PostgreSQL client for Node.js and Deno
#127Also see: https://github.com/gajus/slonik
Re: PostgresJs: PostgreSQL client for Node.js and Deno
#128Earlier quoted context omitted.
> If you were to do this with joins, you'd have a ton of duplicated data returned (via returning every column from every table to have all the relevant data) ARRAY_AGG for Postgres or GROUP_CONCAT for MySQL does what you’re asking without duplicating rows. Re: JSON, don’t. RDBMS was not designed to store JSON; by definition you can’t even get 1st Normal Form once its involved. IMO, claims of DX regarding SQL just mea…
Re: JSON https://www.postgresql.org/docs/current/datatype-json.html Re: RDBMS was not designed to store JSON https://youtube.com/watch?v=rpw_x8TtqTo
Have you ever tested JSON vs. normalized data at scale? Millions+ of rows? I have, and I assure you, JSON loses.
Last I checked, Postgres does a terrible job at collecting stats on JSONB - the default type - so query plans aren’t great. Indexing JSON columns is also notoriously hard to do well (even moreso in MySQL), as is using the correct operators to ensure the indices are actually used.
Re: PostgresJs: PostgreSQL client for Node.js and Deno
#129Earlier quoted context omitted.
prisma appears to have a transaction problem. https://github.com/prisma/prisma/discussions/12715
Wow, a project describing itself as a “Next generation ORM” that… doesn’t do joins, with no way to optimise queries. Perhaps they mean “Next generation” as in, the 1987 TV series sense. Which would still be a long time after the concept of joins…
Re: PostgresJs: PostgreSQL client for Node.js and Deno
#130This library is proper fast. Don't get distracted comparing this to other libraries just on the basis of similar string template syntax; it doesn't have a dependency on pg because it implements its own low level client. I've built systems on this loading multiple 10k records at time and it crushes.
Can load 10-20k records(ymmv) in 20ms or under where it would otherwise take 150ms. That can be a game changer based on use case by itself, but if you are used to thinking about what's viable in Ruby or etc it's even more inspiring.
It also supports logical decode which opens a lot of doors for processing transitional events.
Very impressive project; don't sleep on it!