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 2005 Forums
 Transact-SQL (2005)
 timeout problem

Author  Topic 

joanne
Starting Member

46 Posts

Posted - 2009-04-07 : 21:12:20
I have a stored procedure that was implemented last year.

This procedure is used once every month from aspnet page, to import data from csv file to sql server table and it takes less than 1 minute.

It was ok last month but yesterday, when the client executed the same storproc he had a timeout (after 10 minutes).

I recompiled the procedure which brought back the time to less than 1 minute.

In the future my client wants me to modify the storproc by adding “with recompile” option.
I would like to know your opinion on this matter. Is it a good idea adding this option?

I forgot to tell you that I have restored this db in another environment and the exec time was ok. The developer told me he thinks it is normal because after a restore, all stor proc will be recompiled.
Can someone explain me if really all storproc will be recompiled after a restore?


Does anyone have an idea what could be the cause for the timeout?

There is the error message:

Server Error in '/' Application.
--------------------------------------------------------------------------------

Error for Main Step: Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Exception: Error for Main Step: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[Exception: Error for Main Step: Object reference not set to an instance of an object.]



Thanks in advance for your help

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2009-04-07 : 22:17:19
There is a valid case to be made for using the "with recompile" option, for example, to avoid problems arising from parameter sniffing.
Some info about parameter sniffing here:
http://blogs.msdn.com/khen1234/archive/2005/06/02/424228.aspx
and here:
http://www.sqlmag.com/Article/ArticleID/94369/sql_server_94369.html
(I think you have to be subscriber to sqlmag to be able to read the second article).

Go to Top of Page

darkdusky
Aged Yak Warrior

591 Posts

Posted - 2009-04-08 : 04:22:59
Can you show procedure?
Go to Top of Page
   

- Advertisement -