HACKER Q&A
📣 varrock

What are your experiences with ORMs?


Do you prefer to use an ORM in your backend, or would you rather write raw SQL queries?


  👤 davismwfl Accepted Answer ✓
Depends on what I am doing. For a quick MVP or testing of an idea, I prefer a simple ORM. For a final product I usually like to move it into a data access layer that uses hand written SQL.

I've also used an ORM and then just hand tuned certain queries, but overall I find this takes longer in the end and makes the code harder to pick up for new people.

My complaint about most ORMs is they add a significant amount of code and complexity to both the application and the database. And in my experiences, most software engineers favor the ORM and then the database design suffers, typically meaning performance/scale becomes an issue way sooner than it should. Or if you have a good database design then the ORM requires lots of hand tuning to get it to execute proper joins and queries to minimize the database pressure. So by the time you are done with all the compromises and hand tweaking you could have just written the damn queries and been done and not compromised nearly as much.