Groups | Blog | Home
all groups > sql server (microsoft) > august 2005 >

sql server (microsoft) : Performance improvement after detach/attach


DrewM
8/30/2005 12:00:00 AM
I've got a SQL Server 2000 database serving a classic ASP web
application. The performance of the database keeps nosediving and I
can't figure out why.

When preforming normally, running a known query will return a result set
in 5 seconds. After time, or more commonly after a big data import (the
system allows import from CSV files), the query can take more than 20
seconds to return the same data.

If I go and manually clean out all the data from the import (so the
tables have the same numbers of rows as before) the query will still run
at >20secs. I've also tried rebuilding the indexes and defragmenting the
data disk, and running the maintenance tasks to compact the log files.
Performance remains in the 'sucks' region.

However, if I detach the database and immediately reattach it,
everything perks up and the query runs in 5 seconds again.

I'm not entirely sure what happens during the detach/attach process.
Does anyone here have any ideas as to what might be fixing the issue
(and therefore any clues to the cause)?

thanks,

DrewM
8/31/2005 12:00:00 AM
[quoted text, click to view]

Yes, auto update and auto create are both enabled. Something someone
suggested I try is manually updating the statistics when it's running
slowly.

So as soon as it does it again, I'll try that. Any other suggestions
welcomed!

m.bohse NO[at]SPAM quest-consultants.com
8/31/2005 12:28:20 AM
Is the auto update statistics option enabled ??? It sounds like the
database creates statistics when you attch the database, but don't
update them
AddThis Social Bookmark Button