Performance issue

greenspun.com : LUSENET : SQL Server Database Administration : One Thread

Eric,

Thanks for the answer of my previous question. It helps.

I have another question. I have a stored procedure. In the stored proc, there is a cursor which is tied to a select statement. The select statement consists of joins with a few tables. The main table consists of around 10 million records. Usually, it takes around 20 minutes to prepare this cursor, and the whole stored proc takes around 60-70 minutes to complete.

But sometimes, the same stored proc, with same number of records in the table, may take hours to complete. Or even seems to be never-ending.

What do you think may be the possible causes?

-- Anonymous, August 19, 2004

Answers

Wai Chen,

Perhaps there could be locking issues, or perhaps the statistics could be getting out of date.

You can check for locking issues with:

sp_lock

You can update the statistics with:

UPDATE STATISTICS

Hope this helps,

Eric

-- Anonymous, August 20, 2004


Moderation questions? read the FAQ