On August 1, 2026, I asked my AI assistant a plain question: "Is our website fast or slow?" It did not give me an opinion. It measured. The marketing page loaded in under a second. The app's start page took about a second. The database was small and healthy. Everything was fine except one file.
That file was the app itself: the main program file of the web version, 16 MB before compression and 3.9 MB after. It took about four seconds to download, and every customer downloaded it in full every time they opened KashBoss. Not once a day. Every visit, every refresh.
The cause was one word in a settings file that tells browsers what they may keep. It said "no-store", which means "never keep this file". The intention was good: make sure customers always get the newest version after an update. The right word was "no-cache", which means "keep it, but ask me before using it". With "no-cache" the browser asks "has it changed?", the server answers "no" with zero bytes, and the app opens from the copy already on the computer. The assistant tested it on our live site: 0.39 seconds instead of four.
The short answer
An app feels slow for one of four reasons: the browser downloads too much to start, each screen asks for more data than it shows, the app asks the server too often, or the database works too hard per question. Measure first to find which one it is, then fix that one thing. For any list that can grow large, search, filters, totals and pages must happen in the database, and only the visible page should travel to the user.
The four places time goes
Speed problems are rarely where you guess. Each place needs a different fix.
- What the browser downloads to start. A web app built with Flutter ships as a few large files. Small instructions called caching headers decide whether the browser keeps them between visits. One wrong word means a full download every time.
- How much each screen asks for. A screen that needs ten numbers should not download a whole catalog to get them.
- How often the app asks. Timers that check for news every minute, and live-update subscriptions, add up across hundreds of open devices. Most of our database load came from asking too often, not from asking hard questions.
- How hard the database works per question. Missing indexes (the database's version of a book's index) and security rules that run once per row instead of once per question both slow things down.
Step 1: Measure before you fix
Supabase, the database service we use, keeps a diary of every kind of question the database is asked: how many times, and how long each took. Reading it turned many of my guesses into facts and killed some expensive ideas. In September the assistant first recommended upgrading to a bigger database server. Then it measured properly. The database was reading everything from memory, the load would have been the same on a bigger machine, and the connection count was not growing with customers. The recommendation was reversed: fix the slow questions instead of paying for a bigger machine.
Our caching fix took two attempts: a setting in our hosting provider's dashboard overrode our code and told browsers to keep the file for four hours. The real fix was one dashboard option, "Respect existing headers". Now a returning visitor downloads a few hundred bytes, and updates still arrive immediately.
Big lists belong in the database
If a customer has thousands of products or contacts, the app cannot download them all so that it can search or add them up. The database should search, filter, count and return one page. The app only draws that page.
The date filter that lied. A customer picked an older date in the invoices screen and saw "no invoices". The invoices existed. The screen loaded the latest 50 invoices and then applied the date filter in the browser, to those 50 only. Any day older than the last 50 invoices showed nothing, and moving to the next page did not help. The tell had been on the screen all along: "Total invoices: 50". We moved the date range into the database query for every way the list loads: first load, next page and search.
Search should react while the user types, after a short pause of about 300 milliseconds. Also give every request a number. If a slow answer for "ka" arrives after the answer for "kalon", the app throws the old one away instead of mixing wrong rows into the list.
Pages can quietly skip rows
The database returns at most 1,000 rows per request, so a common fix is a loop: fetch 1,000, then the next 1,000. That fix has a hole. Our record IDs are random, so sorting by ID gives a random order, and each page is a separate request that sees the database at a slightly different moment. If a cashier records a sale while a report reads page three, and the new row sorts before the current position, everything shifts by one and one row is never read. Running the same report twice could give two different totals.
The fixes: calculate totals inside the database in one statement, which sees one consistent moment. When you do need pages, sort by a key that is unique and only increases, and ask for "the rows after this one" instead of "skip 3,000 rows". Skipping is also slow, because the database re-reads everything it skips.
Download only what the screen uses
One of our stock screens needed only a stock number for each product, but it called the big catalog function that returns every product with all its details. For our largest customer that was 1.38 MB. We gave it a function that returns only a map of product to quantity: 87 KB, about sixteen times smaller, with identical numbers on every branch we compared.
Screens that really need the whole catalog, such as the point of sale, now ask for "only what changed since my last copy". When nothing changed, the answer is 141 bytes.
Ask less often
Live updates have a hidden cost. For every table on the live-update list, the database reads its change log whether or not any screen listens. Our list had 19 tables and the app listened to 14. The five unused tables made up most of the changes and over half the database's processor time. We removed them.
A repeated "reload everything" is the most expensive habit in a live app. React to a change by reloading only the changed row.
Timers were the other source: a list of product categories was requested over 25,000 times in two weeks, although categories almost never change. Keep a copy of what rarely changes. Chapter 21 of the book also covers a slow security rule and cheap image storage.
Key takeaways
- Measure first, during working hours, on production. Our slowness was one caching word, one security rule and screens asking too often, not "a slow server".
- Big lists belong in the database: search, filters, totals and pages there, and only the visible page in the app.
- Page-by-page loops can skip rows while a busy shop keeps selling. Sum in one statement, or page by a unique, increasing key.
- Download only what a screen uses, and after a change reload only what changed.
- Test caching on your real production domain, because preview links can behave differently.
Frequently asked questions
Why does my web app download everything every time it opens?
Usually the caching headers tell the browser not to keep the files. A header of "no-store" forbids keeping them, while "no-cache" lets the browser keep a copy and just ask the server whether it changed. Check the Network tab in your browser's developer tools: if a refresh downloads nearly as much as the first visit, caching is the first suspect.
Should I upgrade my database server when my app gets slow?
Not before you measure. In our case the database was reading from memory and the processor load would have been the same on a bigger machine. The slow parts were a few expensive questions and too many requests, and fixing those cost nothing.
How do I make search work on a list with thousands of records?
Do the search in the database, not in the browser. Send the search text to a database function, let it filter and count across all records, and return only one page. Add a short pause of a few hundred milliseconds while typing, and number each request so late answers are ignored.