Simple Strategies to Boost SQL Server Performance

SQL Server is quite the beast. It eats most of your available RAM. And, with a high-volume database, it can also gobble up your IO, leaving your disk with a long queue.

Disk Queue Length, incidentally, is something you can see in Windows 7+, under the Resource Monitor (Start > Task Manager > Performance tab > Resource Monitor > Disk tab)

Anyway, during large inserts, or imports, or selects, you may see your disk queue length spike up. This means that your computer is requesting data from the disk, but it’s busy spinning and getting data for different requests; so they start to rack up.

If you see a queue length of, say, 50, that means you have some heavy IO that’s sucking up all your disk availability and queueing up tons of requests — like when you’re restoring an 8GB database into SQL Server (please, use Attach next time.)

Two easy ways to increase performance in this case:

  1. Not the Windows Partition: By default, SQL Server installs to C:\, the same place as Windows. Move the data files off of the Windows drive. You will immediately see an (often drastic) drop in queue length. Why? Because Windows makes a lot of requests, and if they start to queue up, it can make the queue much longer. If you have a second (physical, not logical) hard drive, that’s an ideal place to locate the files.
  2. Split MDF and LDF Drives: Ideally, if you have three or more drives, you should put Windows on one, your MDFs on a second, and your LDFs on a third for maximum performance.

Again, unless you see the specific problem of disk queue length, you might not need to do all this. Plus, memory is usually a heavier bottleneck for SQL Server, not disk — so check that first.

How can you set the location of the MDF and LDF files? With new databases, when creating them, SQL Server shows you “Database Files” listed under “General,” with a “Path” property. Just change it to something else.

About Ashiq Alibhai, PMP

Ashiq has been coding C# since 2005. A desktop, web, and RIA application developer, he's touched ASP.NET MVC, ActiveRecord, Silverlight, NUnit, and all kinds of exciting .NET technologies. He started C# City in order to accelerate his .NET learning.
This entry was posted in Platform, Tools, Topic, Web and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *