This is simply not true, lots of tools are able to tell you exactly which line of code is responsible for which query.
Re:What ORMs have taught me: just learn SQL
by bkeroack on Monday August 04, 2014 @07:49PM
(#8134740)
Such as? Using ASP.NET and NHibernate, I've not seen any way to do this other than old fashioned log statements and guesswork.
Re:What ORMs have taught me: just learn SQL
by daigoba66 on Monday August 04, 2014 @10:23PM
(#8135227)
http://www.hibernatingrhinos.com/products/nhprof
Worth every penny. You get full stack traces and line numbers automatically with each query.
Not sure about .net since I don't use it but for ruby there are a lot of monitoring services that do this (skylight.io, newrelic etc).
Re:What ORMs have taught me: just learn SQL
by Anonymous_me on Tuesday August 05, 2014 @10:20AM
(#8136994)
> So you have the choice of abandoning the ORM in performance-sensitive paths and inserting raw SQL (making the code ugly) or living with poor performance.
Most people ask themselves the same question and don't care much about performance. I'm glad you choose performance over code aesthetic. Code aesthetic should only come second to how the system performs. As for the ORM, it has it's downfalls. I've never heard of the N+1 query problem in the plain SQL world. It's a problem brought forth by ORM, because it's just stupid to even think about N+1 when you're trying to accomplish as much as you can in 1 query.
Re:What ORMs have taught me: just learn SQL
by idlewan on Tuesday August 05, 2014 @07:01AM
(#8136296)
Django makes queries that are quite readable (and optimized! It makes good decisions to reduce the number of queries), and you can see exactly what SQL is run with the Django Debug Toolbar.
So "[ORMs] make performance diagnostics much harder" is just not true. "Some ORMs make performance diagnostics much harder" definitely is.
I'm a fan of abstractions only when necessary. I want to have control over 100% of the code stack. When performance issues crop up (and they inevitably will), I don't want to just shrug and go "well, Hibernate must be doing something weird..."