Hacker News new | ask | show | jobs
by lmm 479 days ago
> Most of the time you'll either have grossly inefficient multi-roundtrip query code (hidden from you)

Or you spend 5 minutes actually putting some effort in to configuring your ORM. Maybe spend 30 minutes learning if it's your first time. People will spend weeks handwriting SQL to save hours of ORM tuning.

1 comments

In my experience it is the exact reverse. You spend weeks configuring or tuning your orm calls when you ccould just spend a few hours optimizing your sql. There is a reason most orms has a raw SQL escape hatch.

The sweet spot is typesafe sql libraries. You write your raw sql and library deduces the return type from the database and gives you typesafety (sqlx is really good for this, sqlc for go is similar). It gives you almost all the benefits of ORMs with almost no downsides.