SQL Server Performance Tuning

How can I capture performance data over time, and review it later?

Question What is the best way to capture Performance Monitor data and review it over time? I want to be able to produce baseline performance data for my SQL Server so I can compare past performance with current performance. Answer There are a variety of options you can consider. Each has their pros and cons.One […]

The tempdb database grows so large I run out of disk space. What can I do?

Question From time to time, my tempdb database grows so large that it runs out of disk space, which causes the connection that is using the tempdb to die. The tempdb can get as large as almost 6 GB, and the server’s performance really suffers during this process, until, of course, when the connection is […]

Why is my Memory: pages/sec counter exceeding 20 for my SQL Server?

Question I have a server running SQL Server 2000, SP3. I recently used Performance Monitor to track the Memory: pages/sec counter to see if I have a paging problem. What surprised me what that the pages/sec were running over 200, which is way above the maximum value of 20 suggested on your website. What is […]

Are more CPUs better than fewer CPUs for the best performance from SQL Server?

Question All other things being equal, which of the following CPU options is the better choice for heavy-duty queries in SQL Server 2000: –A single Xeon CPU running at 2.4 GHz (with 512KB L2 cache)–Quad Xeon running at 550 MHz (with 1MB L2 cache) Also assume that the server would have 1GB of RAM. Answer […]

Why do I get error messages when my SQL Server is running under a heavy load.

Question I am running SQL Server 2000 on Windows 2000 with 1GB of RAM on a dedicated server, but I am getting the following error message when doing backup and running simple queries like ALTER TABLE. What can be the problem? Server: Msg 845, Level 17, State 1, Line 1Time-out occurred while waiting for buffer […]

How do I know if my table has redundant indexes?

Question I have been taking a look at the queries run against a particular table, along with the indexes on the table, and I have discovered the following: 1) Query #1 uses a composite index that includes a three column index. 2) Query #2 uses a composite index that includes a two column index. 3) […]

Each night we have to run a job that takes about 10 hours to complete. As it runs, it uses 100% of the CPU. What can I do?

Question Each night we have to run a job that takes about 10 hours to complete. As it runs, it uses 100% of the CPU. Obviously, other users are unable to access SQL Server during this time period. What can we do to speed SQL Server up? Answer I see lots of questions like this […]

DBCC INDEXDEFRAG doesn’t seem to work like it should.

Question I have a very large table, over 30 million records, that has a logical fragmentation of about 60%, and this is even if I run DBCC INDEXDEFRAG on it. Is this normal, and if not, what can I do about reducing the fragmentation? Answer In SQL Server 2000, Microsoft introduced DBCC INDEXDEFRAG to help […]

At what point should I worry about page splits, and what can I do to help reduce them?

For those not familiar with page splits, let’s first take a look at what they are. Whenever you INSERT new data into a SQL Server table, or in some cases, UPDATE data in a SQL Server table, there may not enough room for the newly INSERTed or UPDATEd row in the applicable data page. In […]

When should I include the WITH RECOMPILE option when creating a stored procedure?

Whenever a stored procedure is run in SQL Server for the first time, it is optimized and a query plan is compiled and cached in SQL Server’s memory. Each time the same stored procedure is run after it is cached, it will use the same query plan, eliminating the need for the same stored procedure […]