Back to blog
Performance Postgres AI Code SaaS Debugging

Why Your AI-Built App Gets Slower as It Grows (and How to Find the Cause)

By Ken B Portfolio · Published on November 19, 2026
Illustration of a developer working at a laptop

Your app was fast at launch. A few months and a few thousand records later, the main page drags, and nobody changed that code.

Often the code is not broken. It does extra work for every row it reads. On small data that work is invisible. On real data it is the whole wait.

The case: 17 unzips per job

An AI wrote the job list in a job-alert app I build and run. It looked right and it was fast with few jobs.

Each saved job keeps the job board’s full record: description, client spend, rating, hires, country. About 3 KB.

Postgres, the database, compresses any value over about 2 KB and keeps it in a side table, like a zip file. To read one thing from it, Postgres fetches the whole file and unzips it. It does not keep the unzipped copy.

The list showed 17 values per job, like client rating and client spend. So it unzipped the same file 17 times per job. Nothing in the code hints at that: it reads like 17 small lookups.

It also did this for every saved job in the last two weeks, about 1,700, then kept only the 100 it shows. About 30,000 unzips for one page.

How I found it

I did not guess. I timed the page’s server request first: 535–791 ms. Then I timed the slowest database read inside it: about 270 ms, almost all of it spent unzipping.

The fix

  • The 17 values became plain columns, worked out once when a job is saved. The list never unzips.
  • The list now picks its 100 jobs first, then reads their details.

On a copy of the real data, that read went from about 200 ms to 12 ms, with the same 100 jobs.

Then measure again

With the big step gone, I added a timer to every step of the request. The next biggest waits were not where I would have guessed:

StepTimeFix
Asking the sign-in service for the user’s email86–206 ms, every requestRemember it for 5 minutes
Server and database in different citiesa little on every database tripRun the server next to the database
An “is this account set up?” checkseveral trips, every requestOne quick lookup

After all four fixes, the whole request takes 65–78 ms, down from 535–791 ms.

One fix I planned and dropped: the timers showed the remaining reads take about 60 ms, too little to be worth the work.

Check your own app

You can ask for these without reading code:

  • Which step takes the time? Ask for a timer on each step, not a guess. The slow part is often not the one everyone suspects.
  • Was it tested with real-size data? Code that is fast with 50 rows can be slow with 5,000. Test on a copy of real data, with personal details removed.
  • Does it read more than it shows? A page that shows 100 items should not process 1,700 to get there.
  • Does every request call an outside service? Sign-in, payments and email providers each add a trip. Some answers can be remembered for a few minutes.
  • Do the server and the database live in the same region? Every database trip pays the distance.

Skip all this if the page feels fast and your data is small. Measure when it starts to drag, before anyone rewrites anything.

More on what changes as users grow: SaaS scaling readiness checklist.

AI writes code that works. I find where it breaks at real size, measure it, and fix that step, without rebuilding the app.

The short version

An app that slows down as it grows is usually doing hidden work per row. Time each step, fix the biggest one, then time again.

Which page in your app got slower as your data grew?

DIDAPAGEGETSLOW?

Tell me which page got slow and about how many rows it shows, and I'll tell you where I'd look first.

More Posts

All posts