One Guy, a Million Queries: what AI-generated code does to your database. The article below has the numbers.

I want to tell you a little story about a little tool we use. It's an AI tool, written by AI, so we didn't really know what it was doing under the hood. And, man, was it a surprise when we looked under that hood.

Basically, it's a tool that lets us work with multiple agents and build workflows. But that wasn't the surprise. The surprise was when we put Airbrx in front of the backend database.

Our platform gives you a way to keep an eye on the data queries and we started watching what the tool was saying... watching what queries it made to that database.

The first day of traffic was like a denial of service attack. We definitely didn't expect 1.3 million transactions. That's more than 12 queries a second. Even on the weekend, it ran over a million transactions a day.

And I need to be clear about this... there's only one guy using the tool. This isn't in production facing the universe. This is just one user and the tool is hitting the hell out of that database.

Also to be clear, Postgres is built for this kind of volume, and it handles it fine. The whole database costs us $1.51 a day, and the traffic didn't move that cost a penny.

But I'm not saying it's okay because it's cheap. Cheap is kind of part of the problem because we had no idea there was that much traffic, because it was just quietly working.

When we look at what it's actually asking we saw that 99.92% of the time it's sending the same query. It uses the same values and it gets the same answer.

One user lookup ran 161,360 times, to look up 3 users.

It read the agents table 191,846 times, and had one single write. The session permissions table had 196,466 reads, and just 6 writes. Six times anything changed, and it asked about that unchanged data almost 200,000 times.

And it's not even just one trip per question. Begin. Select. Commit. 63% of all that traffic is just opening and closing the door.

A human wouldn't write it this way and a human didn't write it. AI wrote it, and because it works, and nobody looked at what that AI generated code was really doing to the database.

And, sure... it works on Postgres. But think about what happens if you put that same tool on Databricks.

A million queries a day is never going to let a big warehouse go back to sleep. On a medium warehouse, it's going to come out to about $2,000 a day, or a whopping $60,000 a month.

For one guy. And 6 measly writes.

As someone who has worked in enterprise technology a long time, I've seen the surprise bills. Some engineer decides it would be cool to do a side project and experiment with new code. You know, something like "hey Claude, let's build an orchestration tool and use Databricks for my backend."

If that happened, say, on a Friday, and then Monday rolls around, and someone happened to check the bill: $6 grand just showed up on it. Then they scramble to find out why. Then they scramble to turn it off. Maybe another day goes by and another two grand hits the bill.

We didn't have that horror story when we discovered our million queries a day, but we very easily could have. AI wrote the code, and it wrote the chattiest dang database I've ever seen. And we didn't know until we saw the actual traffic.

This is one little tool, and pretty much everybody's building these now.

On Postgres, you might not notice. On a warehouse, the bill is how you find out.

Same query. Over and over and over.