Live data from Hacker News

PostgresJs: PostgreSQL client for Node.js and Deno

github.com

111–120 of 148 posts

Re: PostgresJs: PostgreSQL client for Node.js and Deno

#112
post #98

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?

the list would merit its own dedicated blog post but to highlight a few nice parts, ecto lets me write sql code in elixir. it does not try to wrap it all into objects but I do get schemas. so for instance I can create a schema `Player` which maps to a table "players" I can then get them via ``` from(p in Player) |> where([p], p.id in ^player_ids) |> select([p], p) |> Repo.all() ``` need to join with an association? `…

Have you tried drizzle? https://orm.drizzle.team/docs/select#aggregations

(note: it produces type-safe results too)

Re: PostgresJs: PostgreSQL client for Node.js and Deno

#113
post #108
post #98

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

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

#114

B very careful with json and postgressjs, there are strange bugs. Also there are various gotchas on the edges with typescript. AFAIK the code uses a lot of regex and that breaks json in particular.

This is all very vague and hardly stands up to any kind of scrutiny. Do you have any concrete examples of what you mean?

Re: PostgresJs: PostgreSQL client for Node.js and Deno

#115
post #41

Earlier quoted context omitted.

Sorry, but you’ve been fooled by the web and functional programmers propaganda against performance. Also, what the author seems to mean is that this is faster than specific python, js and go clients. Anyway. At the IO boundary, there’s a lot of syscalls (polls, reads, mallocs especially), and how you manage syscalls can be a major performance sticking point. Additionally, serialization and deserialization can have pe…

> The slow bit can definitely be the client. Yes, but for 99% of "slow database" scenarios : no.

If that was true, then there wouldn’t be database clients that are 100% faster than competitor clients and web servers that are several hundred % faster than slower ones, don’t you think?

“IO therefor slow” is a “myth”. IO is slow, but the 1,000 millisecond request times from the server you’re sitting beside is not slow because of IO.

When experts say “IO is slow”, they’re not saying that you should therefor disregard all semblance of performance characteristics for anything touching IO. They are saying that you should batch your IO so that instead of doing hundreds of IO calls, you do 1 instead.

Re: PostgresJs: PostgreSQL client for Node.js and Deno

#116
post #98

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?

the list would merit its own dedicated blog post but to highlight a few nice parts, ecto lets me write sql code in elixir. it does not try to wrap it all into objects but I do get schemas. so for instance I can create a schema `Player` which maps to a table "players" I can then get them via ``` from(p in Player) |> where([p], p.id in ^player_ids) |> select([p], p) |> Repo.all() ``` need to join with an association? `…

This is probably great to use, but it also highlights in comparison the beautiful simplicity of SQL. Doing something simple is hard, and SQL is so simple that I think most people find little value to abstractions built on it.

Re: PostgresJs: PostgreSQL client for Node.js and Deno

#118
post #108

Earlier 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…

To boldly go where the problem was solved ages ago

Re: PostgresJs: PostgreSQL client for Node.js and Deno

#119
post #112

Earlier quoted context omitted.

the list would merit its own dedicated blog post but to highlight a few nice parts, ecto lets me write sql code in elixir. it does not try to wrap it all into objects but I do get schemas. so for instance I can create a schema `Player` which maps to a table "players" I can then get them via ``` from(p in Player) |> where([p], p.id in ^player_ids) |> select([p], p) |> Repo.all() ``` need to join with an association? `…

Have you tried drizzle? https://orm.drizzle.team/docs/select#aggregations (note: it produces type-safe results too)

Their migrations tool is proprietary and not open-source. The project is basically an open source bait and switch riding off the edge computing hype (since prisma and other major JS ORMs have poor support for edge environments).

Re: PostgresJs: PostgreSQL client for Node.js and Deno

#120

Have 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…

I'd love to see a library like ecto (eilxir) for javascript. its easily the best toolkit for working with sql I've ever found. simple, powerful and easy to reason about

If you like ecto but want something closer to the metal (no need to define type mapping), then check out https://github.com/robconery/moebius

I vastly prefer it over ecto, and ecto is awesome.

Post reply on HN