Live data from Hacker News

We migrated to SQL. Our biggest learning? Don't use Prisma

codedamn.com

21–30 of 104 posts

Re: We migrated to SQL. Our biggest learning? Don't use Prisma

#21
post #9

Drizzle looks like an interesting alternative to Prisma https://orm.drizzle.team You get TS support, tooling, and a very thin layer on top of SQL so little performance hit.

Drizzle is much better in queries, but migrations fail very often.

And a lot of mysql bugs are reported in GitHub and waiting for fixes.

Re: We migrated to SQL. Our biggest learning? Don't use Prisma

#22

Earlier quoted context omitted.

With foreign keys, I can't use https://github.com/github/gh-ost for zero downtime migrations. Instant deal breaker, because schema changes are inevitable given business evolution.

you can always use views + triggers for a zero downtime migration, this is a non-issue

Can you expand on this? I'm curious about the steps.

Re: We migrated to SQL. Our biggest learning? Don't use Prisma

#24
I’ve been tempted to ditch django for typescript in the backend but the sql and migrations story looks a bit … confusing and underwhelming? I feel like typeorm should cover 99% of cases, due to its feature list and age (7 ish years…ancient!), but then you see people often recommending other projects (eg pg_typed). Do people just string things together? Make use of Liquibase?

In 2021 it seemed the TypeORM project was badly maintained and quite buggy - https://news.ycombinator.com/item?id=26888369 . Is that still the case?

Re: We migrated to SQL. Our biggest learning? Don't use Prisma

#25

IMO foreign key constraints are bad; they make migrations and maintenance a nightmare. It's better to have application-level processes in place to ensure data consistency. I don't agree that "no foreign key support" is a good reason to not use a particular solution. Pricing concerns are valid though.

How do you find fkey constraints making maintenance or migrations a nightmare? I've always found them reasonably pleasant to use on postgres.

because programmers are bad at DBA jobs. DBAs don't care about business logic.

Re: We migrated to SQL. Our biggest learning? Don't use Prisma

#26

> Weird pricing: PlanetScale prices you on row-reads and row-writes per month. What is weird is that row-reads is something that nobody controls. It is the SQL query planner which determines the query plan, which results in how many rows you’re reading internally. Remember that row-reads are not row returns. You can write a wrong query that returns 0 rows but can still do a full table scan of 1M rows and PlanetScale…

What do they think is executing the table scan? Do they think that the underlying hardware should be free?

Re: We migrated to SQL. Our biggest learning? Don't use Prisma

#27
People needing to query huge amounts of data discovering technology that's been developed over the past 45 years for querying huge amounts of data efficiently; news at 11.

Seems all these shops starting out with MongoDB or the like always need to do a huge, complicated migration to a /proper/ optimized data store, when they could have started with a sane design in the first place...

Re: We migrated to SQL. Our biggest learning? Don't use Prisma

#28

> Weird pricing: PlanetScale prices you on row-reads and row-writes per month. What is weird is that row-reads is something that nobody controls. It is the SQL query planner which determines the query plan, which results in how many rows you’re reading internally. Remember that row-reads are not row returns. You can write a wrong query that returns 0 rows but can still do a full table scan of 1M rows and PlanetScale…

aurora serverless v2 now supports io optimized mode. which increases the pricing for instances by constant amount but makes the io pricing to 0

https://aws.amazon.com/about-aws/whats-new/2023/05/amazon-au...

Re: We migrated to SQL. Our biggest learning? Don't use Prisma

#29

> Weird pricing: PlanetScale prices you on row-reads and row-writes per month. What is weird is that row-reads is something that nobody controls. It is the SQL query planner which determines the query plan, which results in how many rows you’re reading internally. Remember that row-reads are not row returns. You can write a wrong query that returns 0 rows but can still do a full table scan of 1M rows and PlanetScale…

I also think that this is the old Planetscale pricing. The new one has unlimited reads (https://planetscale.com/pricing)

Re: We migrated to SQL. Our biggest learning? Don't use Prisma

#30
post #14

I would modify this to "Don't use Prisma if you're using serverless" With actual servers and prisma running close to the underlying database, it should be much better. Regarding using joins, that's not necessarily the best choice either. When using simple flat joins naively, you get a lot of repetition for the more toplevel nodes of the join tree, which eventually adds up to a lot of network traffic and allocation. (…

Agreed, if you have some sort of limit, then it seems that AWS Lambda has a limitation you could hit with Prisma.

Prisma has some support for joins with relations: https://www.prisma.io/docs/concepts/components/prisma-schema...

Also, you need to specifically create a transaction to encompass your Prisma calls to limit them to a transaction. This is the default for PostgreSQL as well.

Post reply on HN