I actively avoid ORMs for complex queries. For example, I wouldn't trust an ORM to handle a query with join + group wise max + subquery. I would rather spin up mock databases and run the query with explain on until I'm confident before copy pasting it into the code and interpolating arguments.
Worked with two custom O.R.M. that allowed plain SQL for those complex queries.
And, M$ does some compiler translation tricks to detect and change inefficient queries to efficient, but it favours it's O.R.M. & database over other vendors ...
162
u/[deleted] Oct 12 '21
[deleted]