Re: SP WITH RECOMPILE Option
From: Adam Machanic (amachanic_at_hotmail._removetoemail_.com)
Date: 11/02/04
- Next message: David Browne: "Re: SQL With Website on same server?"
- Previous message: Sergio Santos: "Re: Store procedure"
- In reply to: Ayad: "SP WITH RECOMPILE Option"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 2 Nov 2004 12:20:03 -0500
It sounds as though some user is logging in and specifying parameter inputs
that cause SQL Server to choose an execution plan which is suboptimal for
future executions of the stored procedure using different parameter inputs.
Obviously you've discovered that WITH RECOMPILE comes with some problems but
does help; another option you might consider is creating different stored
procedures for your vastly different parameter inputs which require
different execution plans, having your application call them depending on
which parameters will be used. This is definitely a difficult situation to
solve elegantly, unfortunately...
-- Adam Machanic SQL Server MVP http://www.sqljunkies.com/weblog/amachanic -- "Ayad" <ashammout1@hotmail.com> wrote in message news:%238XmYuPwEHA.2732@TK2MSFTNGP12.phx.gbl... > I have a web application with a back end SQL server db. Every time the users > login to the web site, they execute a SP. > > The issue is that the user is getting a time-out error message when they > call the SP. If I add the WITH RECOMPILE option to the SP, they don't get > the time-out error but on the SQL server it cause a COMPILE x lock on the SP > and slow down the application but they get in. > > Why if I remove the WITH RECOMPILE option, the user will get a time-out > error? > > Thanks > > Ayad > >
- Next message: David Browne: "Re: SQL With Website on same server?"
- Previous message: Sergio Santos: "Re: Store procedure"
- In reply to: Ayad: "SP WITH RECOMPILE Option"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|