Podcast Lookup

Episode 82: ORMs vs SQL

Working Software

  • October 1, 2025
  • 45 min

About this episode

The panel digs into the perennial question: how much SQL should developers know? Kicking off with a war story, Mike recounts a hyper-growth phase where ~20 performance issues were fixed—almost all by database changes, especially adding (or rethinking) indexes—yielding order-of-magnitude speedups. The moral: ORMs are great for safety and productivity, but when things get slow, it’s “usually the database,” and knowing how indexes, JOINs, and query patterns work is what unblocks teams. Will adds a blunt rule of thumb: apps are slow because of “bytes on the wire” or “the database,” and you can’t rely on ORMs alone to prevent N+1s or inefficient access patterns.

From Ops, Kyle reinforces that troubleshooting still lands on SQL: monitoring tools can point to hot spots, but root-causing and backups often require direct database savvy. Eddy shares a counterexample: moving search from Elasticsearch to Postgres full-text revealed that a GIN index on a high-churn table actually slowed writes—illustrating the trade-off that heavier indexing speeds reads but taxes inserts/updates. The group also debates concurrency: for most web apps, you can push work “down the stack” to the database and avoid complex threading; true low-latency, hard real-time concurrency is rarer than many think.

Stepping back, the crew frames SQL as a declarative, optimization-friendly paradigm—closer to functional transforms than procedural loops—which is precisely why database engines can do so much heavy lifting. Resources like SICP and Lisp/Scheme are recommended for learning to “think in streams” and transformations. The consensus: programming languages and frameworks come and go, but SQL endures—and senior engineers still write ad-hoc queries daily to answer business questions and debug production. They close with a teaser for next time: a lively debate about testing private methods and how to design for testability without committing “crimes” against your runtime.

Transcript:

DAVID: Hello, and welcome to the Acima Development Podcast. I'm David Brady, your host today. And we've got a fun panel today. We've got Kyle; we've got Eddy; we've got Mike; we've got Will, and we've got Matt Hardy. Welcome, Matt. Nice to see some new people, well, not new, recurring people. We don't have anybody new, new, new, but nice to see the regulars.

Today we're going to talk a little bit about SQL. Like, do developers need to know it, and if so, how much? And this came as a suggestion from Kyle, who works more in ops rather than frontline web dev. And so, I'm very interested in hearing where he wants to go with this. But first, as our tradition, let's start with some story time with Uncle Mike. Mike, what do you know about SQL?

MIKE: [laughs] So, I do have a story, and I was prepared for this. A few years ago, I say a few, at least five years ago, maybe five or six years ago, I was in a big application that was growing up [chuckles]. We were actually getting a lot of traffic where we hadn't been. It's the startup journey, right? And this actually was at Acima, you know, as we were in our rapid growth era, not that we're not still growing, but, you know, back in the startup days.

And it's natural for every application, once you start going through that growth period, like, oh, wait, there's some things that don't work very well, let me say, that don't perform very well, that don't perform very well. There's things that work just fine when you had a data set of a thousand that don't work very well when you've got a data set of a million [laughs]. Things just don't work quite the same anymore.

And so, I went through with the team, and we worked on that for maybe a couple of months. And over that couple of months, we made the application run about 10 times faster, which is a big deal, right [laughs]? That's a major performance impact. I think it was more than 10 times. I mean, it was a big deal. You know, going to 10 times faster has a big effect on your infrastructure, and I think it even went even beyond that.

But I kind of quit keeping track after a while [chuckles] because it's, you know, you start resetting your baseline. Okay, well, we got to go faster than that, got to go faster than that. It’s not the only time I've done this, right? It's just the most recent time that I have fresh in mind.

And one thing we found is...let me say a couple of things. Every single one of the performance improvements we made, except for one, were database improvements, and most of them were adding missing indexes. So, there's a database table missing an index, and, by the way, it's always a missing index. If you have a performance problem, it's a missing index [laughs]; I'm just going to say that, except there was a couple of them that weren't. A couple of them were some kind of weird cases.

There was some really gnarly JOINs. It was running, like, JOIN against 10 things using a lot of LIKE queries. We fixed that one by using an external index, using a reverse, one of those external reverse indexes. It was Elasticsearch at the time. And that made a tremendous difference as well in our database load.

And there was one that was not a database issue, you know, so we fixed, like, 20 issues, one of them wasn't. And it was because there was something that should have been in the database [laughs] but wasn't. There were some permissions that were being loaded really strangely from flat files and weren't being cached, and every request was reprocessing them. And by putting a little bit of caching and changing the processing, we took that from taking, like, half of every request time down to unmeasurable, right? It just went essentially to zero. It was great, you know, app went way faster. Everybody's happy. Everything's wonderful [laughs]. And we work on other problems.

The lesson I learned from this, though, is that, yeah, it's always the database. And here's the critical thing: adding a database index is something that's really, really easy to miss if you don't know something about how databases work. And most of the time, you don't have to think about it at all, except for that time that you do, and it's the thing that matters most. I found that throughout my career, that yeah, it's always a database index [laughs] or something to do with the database because you don't have to think about it except for that time that you do. And if you don't know that time, then you're burned. And somebody who can come in and can fix that can make a tremendous difference in your application.

Oh, there's the story that I was thinking about as we talked about this topic.

DAVID: Awesome.

MIKE: Do you have to know SQL? Well, I come from an older generation, right, where I cut my teeth writing raw SQL. And I thought it was kind of amazing when we started getting ORMs that would do some of that automatically. There's a whole lot of advantages to that. So, you avoid a lot of SQL injection flaws. You probably get better queries most of the time. So, overall, the switch that most applications have made to using an Object-Relational Mapper (ORM) is a great one. But that experience that we got when we had to do it manually is still incredibly useful. And I worry a little bit that the new devs coming in now are not getting that experience that you usually don't need, except for that time that you do.

WILL: There's only two reasons that your app is slow: bytes on the wire, or your database sucks. That's it.

MIKE: Right [chuckles].

WILL: And if your API is bad, it's just because their database sucks. That's how it works, you know. And, I don't know, I love an ORM. ORMs are great. ORMs are great, and I use them all the time. And, like, 99% of the time, it does it every time. But that's why we make our money. That's why AI is not going to come and get me this year. It's because sometimes...if the junior devs could do it, they would have done it, and it wouldn't be on my desk. And, I don't know, like, you've got to run some gnarly SQL.

I'd also say two things: one, it's not like regular programming. It doesn't follow the same rules. It doesn't work the same way. It doesn't work the same way. SQL, if you're writing a for loop in SQL, you’re f***** up. My one F bomb for the podcast. Let me take it early.

It doesn't work like that, right? And it's not that it's inefficient, but it's just it takes a foundationally different logic to it, and it's everywhere. My PM he was having terrible troubles in Jira this week because our team and all of our Jira stories were getting communicated up to management that was saying, like, “Thumbs up, thumbs down,” Roman emperor style.

And this Jira query was screwed up, and I'm like, I don't know JQL, but I know JQL, and let's face it. And I just got in there, and I fixed it. And it's like, it's everywhere. It's everywhere. It's a foundational programming paradigm that is in everything. You want to do some GraphQL? You should know SQL. It goes in everything. There’s all these sort of, like, abstract layer data management things, and they're all heavily derived from SQL because they're solving the same kinds of problems.

MATT: You should know what's under the hood if you're working on the car. Simple as that. And it's really easy, with an ORM, to get in trouble and write a bunch of N+1s if you don't understand what's going on and what's happening under the hood.

WILL: Absolutely. Absolutely. Like, if somebody asked me and they came in and they were like, “Hey, listen, I have time to learn one thing this year. I could do concurrency, or I could do SQL.” I'd be like, “Just save yourself some time and learn SQL.”

I believe, sincerely, that we're pretty close to the level in programming where most developers will never need to know anything about a thread, not really, you know? You've got an async/await. You can run some coroutines, just kind of spawn a job queue, which you can do, not knowing anything about real concurrency. And you can live and die a productive life without having to wrestle that pig. SQL is not that way, though.

MIKE: Agreed. I may have told it before, but the gnarliest problem I ever worked on as a professional developer was a concurrency problem, and it probably shouldn't have been [laughs]. You get yourselves in all kinds of trouble there. And suffice it to say that there was multiple bugs in the library I was using [laughs], and I had to fix them. And solving a problem that is both concurrent and distributed is hard [laughs], especially with problems in the library.

MATT: Yeah, and few applications require true concurrency.

MIKE: Exactly. If that concurrency had never been in there, it would have worked better [laughs]. And it was the wrong solution for the problem. But I use SQL, well, all the time. This morning, somebody said, “How do I get this data?” and I wrote a query for them.

MATT: I mean, here at the company, we have hundreds of services, and I think one or two actually require real concurrency.

WILL: Yeah, I mean, I'd be surprised, like, what services do you have that require real concurrency, like, a web app? Like --

MATT: Underwriting-related things.

WILL: What's that?

MATT: Underwriting-related things.

MIKE: Lots of parallel requests going out to third parties.

WILL: Still skeptical, but I don't know enough about it to have, like, a strong opinion on it. I mean, because, I mean, I'll tell you, like, honestly, like, really how, like, how things work for really real is, like, all that concurrency, like, modern web apps are concurrent as hell, super concurrent. But you know who does it all? SQL [laughs]. Like, oh man, I got all these parallel requests that I need for, like, high-performance web apps. I’m like, oh man, you don’t need all that. Just kick it down to the database. Let them sort it out.

MATT: Yeah, I mean, it's necessary when you need responses from 12 different third parties at the same time, right?

WILL: Nah, [inaudible 11:19] can wait. You just wait them all. Wait on all of them. You don’t need a semaphore for that. That’s like...when I say, like --

MATT: I would argue, Will, that SLAs say differently.

WILL: Naah. No, no way. Not a chance. Not a chance. Like, your performance isn't that good. Like, if I’m going to network stack, my performance...I don't want to say it like thaaat. But, like, so I mean, for background, right, when I'm talking about, like, real serious concurrency, like, what I refer to specifically in my work, right, is that you work on the radio stack, not TCP, not IP, like, bits and bytes on the wire but wired less, right? Like, working the radio.

I also do a lot of, like, real-time audio programming, and that stuff is serious concurrency. And there's other stuff. It’s like async/await. It's okay. I'm going to fire it off on async, and I'm going to wait for it to come back. We'll, you know, join all my promises together, so I have this big chunk. But, I mean, like, milliseconds, like, a millisecond is an eternity, you know, and, like, you know, on the network, a millisecond is almost not even measurable, you know. Anyway, maybe there's something exotic, and if you're not doing, like, high-frequency trading, like, I don't know, probably the technical detail’s not something that's appropriate to get in here anyway.

DAVID: There's a CS professor at the University of Utah, can't remember his name, but the best quote...he was an audio CS guy in the ‘90s back when, you know, a 486 was all you had and, you know, at 33 megahertz grinding away.

WILL: [inaudible 13:06]

DAVID: And a friend of mine was in his audio processing class, and efficiency was the buzzword. And he finally says, “So, I have to do this before the next stroke of, like, sending bits to the sound card.” And the professor goes...I'm sorry, the professor wasn't in audio. He did some audio, and he didn't realize he was talking with my friend about audio. And he looks at my friend, and he goes, “Wait, you're doing audio? You'll have milliseconds,” and walked away. Literally, that is a lot of how concurrency is today, right? It's like, I got a four gigahertz processor. I can chew this elephant from front to tail serially and just take a blocking operation, and it's two, you know, two milliseconds or whatever, and you get through it.

I've had one app where concurrency was critical, and it's anywhere you need to be handling multiple threads of attention live or giving the appearance of live. I wrote an IRC client, so you have to catch keystrokes coming in from the user before they hit enter, so you can't do an input read statement. You have to stroke, stroke, stroke, stroke, and update that. Meanwhile, the server is throwing network bytes on demand at you over the fence, and you can't re-request them, or it's like, you have to handle those network packets when they come in. And that was the time when we had to interleave.

MATT: You just gave me flashbacks.

WILL: Yeah, the battle days.

MATT: I've written a few IRC clients back in the day.

DAVID: Getting off topic, but IRC is what broke me of Python. I was in love with Python. I'd come from Perl, which is super cryptic, and messy, and dense, came into Python, which was clean and beautiful. And you cannot condense it down to a single line. And when you are scripting an IRC client, you have one line to do everything, and that's what pushed me...It pushed me back to Perl and then forward to Ruby.

WILL: Interesting. I don't know, here there be dragons. Don't mess with concurrency. Don’t do that.

MIKE: Exactly. That's the moral of the story.

DAVID: Touching back, though, a little bit, there are times when you have a high-level framework, and it starts acting weird, or you change a feature, and something completely unrelated changes. And if you are very familiar with, like, SQL and how database engines work, that's when you go, oh, we're reading the leases table on a new column. I wonder if it's not indexed because that would slow everything down in this chain, right?

And it's, yes, we do...I'm old enough that I was in the generation of people that had the math teacher that said, “You won't always have a calculator with you. You need to learn your times tables.” Well, I have an iPhone. Well, I have an Android. I've got a computer in my pocket now. You were wrong about that, Mr. Nelson.

WILL: No, he wasn’t.

DAVID: SQL might be headed that way, but right now, you don't always want to pull out your phone to be a calculator. And when you can just look at a website and go, that's misbehaving in this specific way, and I can see through the ORM to the underlying technology, it’s super powerful.

MATT: Well, it provides value.

WILL: Well, Matt brought this up, and I think that nailed it. I mean, in that, like, it's really easy if you're in an ORM to write N+1 queries, right? To write a double-nested loop instead of, like, just getting the whole enchilada.

And I think I would liken it to memory management in that, like, nobody, I mean, much like, you know, much like concurrency, like, nobody's malloc-ing anything if they have any sense in the year of our Lord 2025. But you still need to know how it works because you can definitely leak.

MIKE: It's not that hard to do. Just make a global hash in memory, and keep it persistent.

WILL: Yep. Yeah, man, I have a ticket in my backlog right now, which is, like, go leak hunting. You’ve got to dump that heap. Kyle and I we've dumped a heap or two, you and I [laughs].

DAVID: Actually, that reminds me of something else. We said at the top of the call, Kyle, you live over in Ops land. What are you doing talking to databases?

KYLE: What am I doing? A lot of it has to do with we manage our RDS instances, and it's a lot of the time troubleshooting or backups. Those are the bigger issues. That's kind of where I thought about this topic is because in prior organizations, I mean, older codebases, older companies, they didn't use ORMs. A lot of it was just straight SQL. And so, everybody that I spoke to they knew and understood SQL.

And one drawback that I have seen with ORMs, while they are great, is when you need to get in and troubleshoot and dig around, you need to find the engineers on your team that actually know SQL, because not all of them actually know SQL, in order to help troubleshoot with you, right? There are tools out there that kind of bridge some of the gaps and will identify, oh, you don't have an index or something on your table, which we utilize. We've got New Relics and Data Dogs of the world that kind of help us identify some of those things. It gives us benefits in some areas.

In other areas...I think somebody said, 99% of the time, it's great. And then you run into the 1%, and then you run into an engineer that is not very versed in SQL. Not to say that I'm great with it either, but it does slow down troubleshooting. It does slow down figuring out the root cause of the database problem. Because, like Will pointed out, if your app is slow, the first thing I'm going to is the database. Is something happening with the database, right? Because that's where most of the problems come from. If it’s not the database, it's something like Redis, another pseudo database, or --

MIKE: Another database.

KYLE: Another cache location, right? It's always in these locations. And ORMs make it really easy to develop. They make it a little bit more difficult when you need to troubleshoot. And I won't even say just ORMs, ODMs, too, anything that's doing it for you or helping you without ac