Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

From a performance perspective, N+1 queries are spectacular, but the much more pervasive problem is simply that they encourage poor discipline about hitting the database.

Most ORM code bases I've looked at do a pretty decent job with avoiding N+1 queries. But they've all been guilty of doing things like incurring orders of magnitude more network transfer than is necessary by pulling down a collection of objects just to calculate the sum over a single field.

I think that stuff ends up being so common because it's exactly what heavyweight ORMs are encouraging you to do. To an approximation, their entire point is to make it easy to forget that you're talking to a remote resource.

And, for that matter, by hiding the subtlety of the relational model, they also hide the power of the relational model.



This just comes down to caring about the work you do and putting in the effort to ensure you are delivering quality/performant code. If your devs can't handle that then you have a lot more problems than a heavyweight ORM. No developer worth their salt would be "encouraged" by a library to write bad code.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: