I totally agree with you. Writing raw SQL, and really just thinking of usecases in a more data-orieted way I think leads to clearer and more maintainable code, even if it takes a little more time initially. Although even then, I have to say ChatGPT can spit out such good SQL and accompanying Go models now that its not even that slow to do.
We've taken over a rails codebase at work, and the number of O(n) queries that are being done instead of bulk queries is rather shocking. I'm sure that one can write efficient queries using the Rails ORM, but it does seem to me that the presence of it allows for more misuse.
My experience is that if one has never thought in sets, only in iterations, then the proverbial "when you're a hammer, everything looks like a nail" kicks in and every database query become a for-loop or, if it's Rails, an each-loop.
We've taken over a rails codebase at work, and the number of O(n) queries that are being done instead of bulk queries is rather shocking. I'm sure that one can write efficient queries using the Rails ORM, but it does seem to me that the presence of it allows for more misuse.