Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 SQL 2000 Sudden performance drop

Author  Topic 

Fletch
Starting Member

29 Posts

Posted - 2007-05-31 : 06:33:01
I realise there must be many threads about performance but having done some reading I'm still none the wiser.

We have a regular job that adds data to the database. What used to run in a couple of seconds now (suddenly) takes a few minutes to run.

I have a copy of the database on a different machine; same data, same volume of data (around 7gig) and it still runs fast there.

Given that the problem appears to be environmental I've had a look at memory usage, Disk Queue, Pages/sec etc.

While the importer runs:
% Processor goes up to 50% (all of 1 processor)
The Avg. Disk Queue goes above 100 for a few seconds at a time.
The buffer cache stays close to 100%

My pagefile usage remains at around 90% of 2gig all the time (I have 2gig of RAM)

Any advice hugely appreciated.

Kristen
Test

22859 Posts

Posted - 2007-05-31 : 07:54:27
Are the statistics updated regularly?
Are the indexes rebuilt regularly?

Are the indexes the same on both machines? (Number, and DDL, of the indexes)

Kristen
Go to Top of Page

Fletch
Starting Member

29 Posts

Posted - 2007-05-31 : 08:15:31
I've never (knowingly) update the statistics.
I did a defrag on the indexes and then a full rebuild of them.

Things appeared to improve a little but it's still taking five minutes to run what used to be a 10 second job.

I believe the indexes are the same on both machines. The second (faster) machine database was a restore of the live a couple of months ago, and updated in parallel ever since.
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-05-31 : 10:10:45
Rebuilding index will update statistics, but how often do you do that? Did you rebuild clustered index? If not, you can't defrag table.
Go to Top of Page

Fletch
Starting Member

29 Posts

Posted - 2007-05-31 : 10:30:35
I ran a script that claimed to rebuild ALL indexes. I haven't defragged since then (actually I've only ever defragged the indexes rather than the whole table anyway).

I obviously need to look at defragging the tables as well as the indexes.
Will defragging the hard disk make a difference? I assumed SQL would lock it's files on the disk anyway so windows defrag wouldn't make any difference to this particular problem.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-05-31 : 10:34:05
Update the statistics anyway, it can't hurt! (but it might slow the server for a while whilst updating):

exec sp_UpdateStats

If your "job" calls a Stored Procedure it would be wise to recompile that too, after updating the stats:

EXEC sp_recompile 'MySproc'

Kristen
Go to Top of Page

Fletch
Starting Member

29 Posts

Posted - 2007-05-31 : 11:12:18
Hmmm.
It gets 75% of the way through the job and then perfmon is showing the average disk queue is oscillating between 0 and 100. This must indicate the disk is being hammered. Would this be due to fragmentation or memory being swapped to disk?
Go to Top of Page
   

- Advertisement -