3 ms·
It's the reverse for me. When I join a team, I get hit in the face with an existing ORM. It makes debugging performance issues completely opaque. Two issues
by mrkeen 4y ago
It's the reverse for me. When I join a team, I get hit in the face with an existing ORM. It makes debugging performance issues completely opaque.
Two issues in my current code base are on my mind:
Firstly, our slowest query involved the ORM generating a "CROSS JOIN" clause in a query which returned 0 or 1 results. Of course there was no way of tying it back to the code which was emitting it without some investigation. Real SQL would have shown up in a text search.
While investigating the above problem, I came up with a replacement query which would take 5 ms rather than the ~400ms it currently took. Unfortunately I couldn't use the query because my change (ordering by B.time instead of A.id) didn't return strictly the same results. But they should have matched. It turned out there was a slight race in writing out our rows via the ORM. We're currently not touching it because we're worried about breaking it. If it were SQL strings, I'd just wrap them in a transaction.
SQL is already the do-everything high-level abstraction. Trying to put Java code on top of SQL is like trying to put a for-loop on top of a map-reduce cluster.