Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Have to Recreate SP (periodically) To Prevent Timeout Error 2

Status
Not open for further replies.

JohnBates

MIS
Feb 27, 2000
1,995
US
hi everyone,

We have an ASP page that sometimes starts giving a 'Timeout Expired' message.

Thru trial-and-error, I've discovered that by simply dropping and recreating the stored procedure, that resolves the issue and (for a few days) the web page no longer gives this error.

We know that tables needs frequent maintenance (rebuild indexes etc), but why would a stored proc have to be recreated every few days ?

This is SQL Server 2000, IIS 5 and ASP 3/Classic.

Thanks!
John
 
It's been a while since I've had much to do with SQL Server, but if memory serves, it may be that the execution plan of the SP becomes "obsolete" after a while, especially if a lot of data has been added/removed/changed in the underlying tables.
So the SP is no longer using the best plan for the needs of the query.
You could use the WITH RECOMPILE option I believe, to get over this problem

~LFCfan
Who is relieved Friday has finally arrived

 
Thanks LFCfan and SQLDenis.

I run dbreindex on these tables and update the statistics every weekend, then I updateusage on the database.

I will add WITH RECOMPILE and try that for awhile. This proc gets called maybe 50 times per day so it may slow the web user down a bit if it has to recompile each time it is executed, but it's worth a try.

I appreciate the tips!
Thanks. John

 
..... Today the web page was timing-out again. I recreated the stored proc and it still timed-out.

Then I deleted, recreated the main view and that resolved the problem-the web page renders the data within 6 seconds.

But it's not a permanent fix - in a day or 2 the ASP page will be timing-out again.

I'm thinking of scheduling a delete and recreate of the view and the stored proc - to run each night. I don't have to do that on any other server, so I'm (stubbornly) trying to find a better soultion. I already run table reindexing and update stats on the weekends.

OK I'll stop complaining now :)
Thanks, John
 
>>Then I deleted, recreated the main view and that resolved the problem-the web page renders the data within 6 seconds

its not an indexed view right? just wanted to know...

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top