Live data from Hacker News

Show HN: Postgres.js – Fastest Full-Featured PostgreSQL Client for Node and Deno

github.com

31–40 of 87 posts

Re: Show HN: Postgres.js – Fastest Full-Featured PostgreSQL Client for Node and Deno

#33
post #27

Thanks porsager. Any plans for Knex support?

> Any plans for Knex support?

That question doesn't really make sense. I'm not familiar with this library, but the developer interface is very similar to slonik. The whole point of this is that SQL tagged template literals replace the need for a query builder like Knex.

Here is a good blog post from the author of slonik explaining: https://gajus.medium.com/stop-using-knex-js-and-earn-30-bf41...

Re: Show HN: Postgres.js – Fastest Full-Featured PostgreSQL Client for Node and Deno

#35

I’m curious, how does this project compare to slonik that is also a fast, lightweight, full featured, using SQL template literals etc ? Is there any reason to consider switching, for example?

There is quite a big difference, but I'll highlight some of the main points here. Note I'm the author of Postgres.js so I'm obviously biased.

Slonik is a wrapper around another node driver (pg), so it's performance is the same as that, where Postgres.js is significantly faster (2-5x)[1].

Postgres.js is also a zero dependency module, whereas Slonik has quite the dependency graph meaning - compare https://npmgraph.js.org/?q=slonik with https://npmgraph.js.org/?q=postgres. That makes it more difficult to audit the code and preventing chain attacks etc.

Slonik also doesn't have the same lean straight forward developer experience as Postgres.js - again I'm biased saying that ;)

Postgres.js also does things that will make your queries perform better out of the box by implicitly creating prepared statements and using pipelining.

I suppose you could build Slonik on top of Postgres.js instead of pg as well, but that would probably only make sense if migrating to Postgres.js.

[1] http://github.com/porsager/postgres-benchmarks#results

Re: Show HN: Postgres.js – Fastest Full-Featured PostgreSQL Client for Node and Deno

#36

Here is the bundlephobia of this: https://bundlephobia.com/package/postgres@3.0.0 33.6 kB Minified 12.5 kB Minified + Gzipped

Hey - that's pretty nice :) Didn't think of trying that - curious if it includes the cjs and esm version in the sum, since that's double of almost identical code.

Re: Show HN: Postgres.js – Fastest Full-Featured PostgreSQL Client for Node and Deno

#37

Earlier quoted context omitted.

Thanks. Definitely production ready, and I've been using it for quite a while in production myself, towards this release. About the ORM layer I wouldn't know, since I much prefer to avoid that at any cost.

Ok, I'd have to double check to see if the Unlicense is ok for work projects, but this is a great contribution to the node ecosystem.

I actually replaced WTFPL with Unlicense since someone at google couldn't use it, so I would think it's ok?

Re: Show HN: Postgres.js – Fastest Full-Featured PostgreSQL Client for Node and Deno

#38
post #27

Thanks porsager. Any plans for Knex support?

> Any plans for Knex support? That question doesn't really make sense. I'm not familiar with this library, but the developer interface is very similar to slonik. The whole point of this is that SQL tagged template literals replace the need for a query builder like Knex. Here is a good blog post from the author of slonik explaining: https://gajus.medium.com/stop-using-knex-js-and-earn-30-bf41...

[deleted]

Re: Show HN: Postgres.js – Fastest Full-Featured PostgreSQL Client for Node and Deno

#39
post #27

Thanks porsager. Any plans for Knex support?

Yeah, I think it could make sense for performance reasons to make a version for Knex, but since I try to stay away from ORMs as much as possible I'm probably not the right one to make it ;)

I also wouldn't put it in the core library anyway, so it should be straight forward for someone else to make a knex-postgres package that does this?

Re: Show HN: Postgres.js – Fastest Full-Featured PostgreSQL Client for Node and Deno

#40
Very interesting project! The source is inspiring, it seems the author has made an explicit choice to minimize dependencies.

Even transpilation from ES modules into commonjs is done by the author himself:

https://github.com/porsager/postgres/blob/master/transpile.c...

I’m not sure if I’d made the same choice, but it’s fun the see it can work out great :)

Post reply on HN