6 ms·
ORMs are great for avoiding boilerplate and adding some typesafety. But once you start doing complicated things like JOINs, it's better to drop into raw SQL. >
by superb-owl 4y ago
ORMs are great for avoiding boilerplate and adding some typesafety. But once you start doing complicated things like JOINs, it's better to drop into raw SQL.
> Listen to this old man's advise: learn SQL properly. It's not that hard.
I couldn't agree more with the first half, or disagree more with the second :) Once you're operating at scale, it takes a lot of fine-tuning, know-how, experimentation, and reading docs to get things moving efficiently.
- phendrenad2 4y agoWhat are some examples of fine-tuning or trial-and-error you might need at scale?
- superb-owl 4y agoPostgres has a ton of parameters that can greatly affect performance. I've used https://pgtune.leopard.in.ua/ https://pgtune.leopard.in.ua/ to help w/ that. In terms of schemas, where you put your indexes matters a TON. Indexes make reads faster and writes slower (to oversimplify). Figuring out where to break out a separate table vs keep everything in one table is also a common issue.
- phendrenad2 4y agoTrue, all of these would still be an issue with ORMs.