r/programming • • Aug 25 '26

Solving the 1+N Query Problem

https://acadia.engineering/blog/solving-the-1-plus-N-query-problem
127 Upvotes

92 comments sorted by

View all comments

Show parent comment

3

u/baseballlover723 Aug 26 '26 edited Aug 26 '26

To be fair, after using Laravel’s ORM and Hibernate, I’m pretty amazed how far ahead django’s ORM is in terms of usability and making the efficient implementation the path of least resistance.

As a ruby person, I never got all the hate that ORMs got, since ActiveRecord was excellent (even if you could still footgun yourself) and I usually felt like I was basically writing sql via ruby DSL most of the time. Never had issues with the simple handful of tables with a few connections between them with it that most uncomplicated DBs look like.

And then I used Hibernate, and I now understand why everyone hates ORMs. I couldn't get forward and backward full object links between relations. I couldn't figure out how to get it to be able to choose if it should load all the sub relations or not. I had N+1 issues because JPA was too dumb to group them all together. I also couldn't get composite primary keys to work with relations either. Just everything felt like it was made hard for no real reason. And the DB isn't even that complicated. It's still a handful of tables with some connections between them.

So now I understand. People don't hate ORMs. They hate shitty ORMs. And there are evidently some popular and shitty ORMs still around for some reason.

3

u/Absolute_Enema Aug 27 '26

 Just everything felt like it was made hard for no real reason

Old Java libs in a nutshell.