Live data from Hacker News

PostgresJs: PostgreSQL client for Node.js and Deno

github.com

91–100 of 148 posts

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

#91
post #78

Earlier quoted context omitted.

Had to check if I wrote that lib. I wrote pretty much the same thing, not sure if I published it standalone...

> Had to check if I wrote that lib.. This reminds me of a friend of mine.. He got struggled with a programming-related task. When he gave up, he turned to StackOverflow, where he found the exact answer there, ready to be copy/paste. Ironically, it turns out that he was the one who answered it a few years back :)

Oh, that happens to me quite a bit (I'm a top 500 SO user). I find some great question or answer and then try to upvote it and then get confused why it won't let me.

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

#93
Related:

Show HN: Postgres.js – Fastest Full-Featured PostgreSQL Client for Node and Deno - https://news.ycombinator.com/item?id=30794332 - March 2022 (83 comments)

Show HN: Postgres.js – Fast PostgreSQL Client for Node.js - https://news.ycombinator.com/item?id=21864245 - Dec 2019 (12 comments)

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

#94
This 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.

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

#95

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

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

#96
post #27

reposting my comment on its benchmarks: On what makes it postgres.js faster, from author himself: > it seems Postgres.js is actually faster than, not only pg, but of any driver out-there - https://github.com/porsager/postgres/discussions/627 - https://porsager.github.io/imdbench/sql.html

[deleted]

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

#97
post #2

The benchmarks linked to don't compare PostgresJs to Prisma. That would be useful. Also the link text (Fastest full-featured node & deno client) should include the word benchmark, for those looking for one.

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

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

#98

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

Curious what you think makes it better than other examples out there? How is it different than Active Record or Prisma?

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

#99
Terrible name, makes it impossible to search on.

The problems start immediately when you realize it’s interchangeably called “Postgres”.

Any other name would have been better as long as it’s distinctive.

Even so I use it, best Postgres javascript library.

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

#100
post #98

Earlier quoted context omitted.

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

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?

```

from(p in Player) |> join([p], s in assoc(p, :scores), as: :score) |> where([p], p.id in ^player_ids) |> preload([p, score: s], [score: s]) |> select([p], p) |> Repo.all() ```

this gets me all players with their scores.

need to get the sum of scores for all players?

```

from(p in Player) |> join([p], s in assoc(p, :scores), as: :score) |> where([p], p.id in ^player_ids) |> select([p], %{ player_id: p.id, score: sum(score.value) }) |> group_by([p, score: s], [p.id]) |> Repo.all() ```

as you can see, you can unwind this pretty fast to sql in your head. but you can also let the system just grab the kitchen sink when you jsut need to get somethign working fast. and its all very easy to modify and decuple.

this is hardly exhaustive though, I could spend a day talking about ecto. I spent 8 years developing in nodejs but now I work exclusively in elixir. unless what you're doing is 90% done by existing libraries, its juts a better tool for building highly performant backends.

Post reply on HN