logoalt Hacker News

esafaktoday at 12:11 AM7 repliesview on HN

I read it as: Why You Shouldn't Use Prisma and How Cockroach Hung Us Out To Dry

I already knew about prisma from the infamous https://github.com/prisma/prisma/discussions/19748


Replies

vvpantoday at 3:57 AM

I am in a startup that's using Prisma and it we really wish we had not:

- The query objects can become hard to read with anything more or less complex.

- If you need an unsupported Postgres extension you are out of luck.

- One large file in a schema, impossible to shard.

- We have many apps in a monorepo and they cannot have separate prisma connections cause the schema gets baked into "@prisma/client"

Basically the only thing useful about it are the TS types which is something SQL-builder libraries solve better. Long story short, use Kysely, Prisma provides no value that I see.

pier25today at 12:43 AM

Prisma is so bad... can you believe it's by far the most downloaded ORM in NPM?

show 2 replies
etblgtoday at 12:20 AM

> It's true that Prisma currently doesn't do JOINs for relational queries. Instead, it sends individual queries and joins the data on the application level.

..........I'm sorry, what? That seems........absurd.

edit: Might as well throw in: I can't stand ORMs, I don't get why people use it, please just write the SQL.

show 5 replies
coverjtoday at 12:55 AM

I didn't mind prisma for managing the schema etc but also seen your linked github issue. I found other people recommend combining Prisma with Kysley. I have only used this in toy projects so take this with a grain of salt.

https://kysely.dev/ https://github.com/valtyr/prisma-kysely

frollogastontoday at 12:27 AM

I'm not the most experienced in huge DBs and can't write anything off, but I've never seen a horizontally sharded DBMS work well, even Citus which allegedly does. There's always been a catch that seems worse than manually doing sharding at a higher level than your DB, not that that's easy either.

show 2 replies
ScalaHanSolotoday at 1:22 AM

Author here. Yeah, that's not a bad take away either. I've also been really vocal in Primsa issues for all sorts of things. We are about to embark on a big migration away from Prisma and onto Drizzle once the Drizzle team lands 1.0

We will absolutely share our findings when that migration happens!

show 1 reply
cess11today at 10:31 AM

"Instead, it sends individual queries and joins the data on the application level. However, this doesn't mean that Prisma's relational queries are per se slower"

Wow, what the fuck.

"Also, this chapter about Query Performance Optimization from the High Performance MySQL book has some great insights. One of the techniques it mentions is JOIN decomposition:

    Many high-performance web sites use join decomposition. You can decompose a join by running multiple single-table queries instead of a multitable join, and then performing the join in the application."
This belief that they can write JavaScript that outperforms decades of bare-metal executed optimisations in mainstream database engines is just astonishing.