Comparisons
Ten pairs that get conflated in real conversations. Neither column wins — what decides is the requirement. Each record leads with the confusion, because the confusion is the reason the record exists.
ORM vs Raw SQL
The argument is framed as a moral one — ORMs are bloat, or raw SQL is unsafe — when it is a per-query decision inside a single codebase. Both claims in the guide's forbidden list live here: ORMs are neither always bad nor always fine. The real cost of an ORM is that it hides how many queries you just issued.
CRUD-shaped access across many entities, where consistency of mapping and migration tooling saves more time than the abstraction costs.
Reporting, bulk operations, window functions, recursive queries, and any path where the exact plan matters.
| Dimension | ORM / data mapper | Hand-written SQL |
|---|---|---|
| Best at | Uniform entity CRUD, relations, migrations | Set-based work and anything plan-sensitive |
| Failure mode | N+1 and surprise queries you did not write | Duplication, and injection if you build strings |
| Visibility of cost | Low — one attribute access can be a query | High — the query is the code |
| Safety by default | Parameterised unless you opt out | Safe only if you always parameterise |
| Team effect | Newcomers productive quickly | Requires SQL fluency on the team |
| Realistic answer | Use it for the 80% that is CRUD | Drop to it for the queries that matter |