The system used to be quick and now it is slow
Slowness that has crept in over years usually has a small number of specific causes, and they can be found by measuring. We find them, fix the ones that matter and show you the difference.
Slow by degrees
It did not happen on a particular day. The order screen that once opened instantly now takes eight seconds. The month-end report times out unless it is run in the evening. The overnight import that used to finish in the small hours is still running when the first person logs in. Staff have adapted: they start a search and look at their phone, and they know which screens to avoid on a Monday morning.
Because it crept up, it is easy to accept as the way things are. It rarely needs to be. A system that was quick with less data can usually be made quick again.
What usually lies behind it
In business systems the cause is most often in the database, and most often one of a short list.
Growth. A query that searches a table without a suitable index reads every row. With ten thousand rows nobody notices. With ten million it takes seconds, and it gets a little worse every week.
Queries that fetch too much. A screen that shows twenty orders may be loading every order ever placed and discarding the rest, or running a separate query for each line on the page.
Reports on the live database. A report that reads two years of transactions competes with the people entering today’s. Each can block the other.
The server. It may be short of memory or sitting on slow disks, or the database may have been installed with default settings and never adjusted. Maintenance jobs that keep indexes in order may have stopped running long ago.
The browser. In web applications that stay open all day, a screen can leak memory until it crawls. If refreshing the page makes it quick again, the database is not the culprit.
Measure before changing anything
Everyone has a theory about why the system is slow, and the theories often disagree. A database such as SQL Server keeps its own record of which queries run, how often and how long they take. Reading that record changes nothing on the system, and it usually shows that a small number of queries account for most of the waiting.
You can make a start this week. Ask staff to note which screens and reports are slow, at what time of day, and roughly how long each takes. Check whether the slowness is constant or comes at particular times, which would point to a clash with a scheduled job or a backup.
Your options
Buy a bigger server. Quick to do, and right if the measurements show the server is short of memory or processing power. It is rarely the lasting fix. Hardware gives a one-off improvement, while a query that scans a growing table keeps getting slower. Some time later you are back where you started with a larger bill, particularly in the cloud, where the bigger machine is charged for every month.
Tune what you have. Add the missing indexes, rewrite the worst queries, correct the server settings and restore the maintenance jobs. Your IT provider or a database administrator can do the server side. The query work needs someone who can read the application.
Move reporting off the live database. Where reports are the problem, running them against a copy removes the contention.
Archive old data. If the system holds fifteen years of records and people use the last two, moving the rest out makes everything smaller.
Where we would start
We would measure. Our SQL Server performance service starts from the database’s own evidence and deals with the few queries that cost the most. Each change is timed before and after. If the findings point to something larger, such as a design that cannot cope with the volume, we say so and set out the choices. Keeping the system quick afterwards is part of a maintenance arrangement.
Talk to us
Describe the system and what you need. You will hear back from someone who can answer technical questions.
Discuss your slow system 0800 433 7990The usual causes
- Data growth
- Tables that held thousands of rows now hold millions, and queries written for the smaller size have not been revisited.
- Missing or unsuitable indexes
- The database reads a whole table to find a few rows, because no index matches the way the data is now searched.
- Queries that load too much
- A screen fetches every column of every record and then displays twenty of them, or runs one query for each row in a list.
- Reporting against the live database
- A large report competes with the people entering orders, and each slows or blocks the other.
- An undersized or misconfigured server
- Too little memory, slow disks, or database settings left at defaults that do not suit the hardware.
- Memory leaks in the browser
- A web screen left open all day uses more and more memory until it crawls, and is quick again after a refresh.
How we approach it
Pin down the complaint
Which screens, reports and jobs are slow, for whom and at what times, and how long each takes today.
Measure
We read the database's own statistics and the server's counters to see where the time goes.
Fix the few that matter
The queries, indexes or settings responsible for most of the delay are changed first, on a copy and then on the live system.
Measure again
The same screens and jobs are timed after each change, so you can see what it achieved.
Keep watch
Data keeps growing, so slow queries are monitored and dealt with before users notice.
A good fit when
- Screens that once opened instantly now take many seconds.
- Reports time out or have to be run out of hours.
- Overnight jobs are still running when staff arrive.
- You have been advised to buy a bigger server and want to know whether it would help.
Probably not for you if
- The slowness is in a packaged product you cannot change. Its vendor is the place to start, though the server and database underneath it can still be checked.
- Every application on the network is slow. That points to the network or the PCs, which is a job for your IT provider.
Questions we are asked
Would a bigger server fix it?
Sometimes, for a while. If the server is short of memory, more memory helps. But a query that reads a whole table gets slower as the table grows, and extra hardware only postpones that. Measure first, then buy hardware if the measurements say so.
Why did it slow down when nothing has changed?
Something has changed: the amount of data. A query that scans a table takes longer as the table grows, so a system can slide from quick to painful with no change to the code. More users and more reports add to it.
Can you speed it up without rewriting it?
Usually. Most performance work consists of adding or correcting indexes, rewriting a small number of queries and adjusting server settings. The screens stay the same.
Do you need the source code?
Not to begin with. The database shows which queries are slow without it, and index and server changes need no code. To rewrite a query that the application itself issues, we do need the code.
Is the investigation safe to run on the live system?
Yes. The first stage reads statistics the database already collects and changes nothing. Any change is tried on a copy first and released at a quiet time.
Tell us about your system
Say what it does, what it is built on and what is worrying you. We will reply with what we would look at first and whether we are the right people to help.