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

What people get wrong about this pair

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.

ORM / data mapper
Use it when

CRUD-shaped access across many entities, where consistency of mapping and migration tooling saves more time than the abstraction costs.

Hand-written SQL
Use it when

Reporting, bulk operations, window functions, recursive queries, and any path where the exact plan matters.

DimensionORM / data mapperHand-written SQL
Best atUniform entity CRUD, relations, migrationsSet-based work and anything plan-sensitive
Failure modeN+1 and surprise queries you did not writeDuplication, and injection if you build strings
Visibility of costLow — one attribute access can be a queryHigh — the query is the code
Safety by defaultParameterised unless you opt outSafe only if you always parameterise
Team effectNewcomers productive quicklyRequires SQL fluency on the team
Realistic answerUse it for the 80% that is CRUDDrop to it for the queries that matter