![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi I've heard 2 things recently, can I confirm if their true/false? (1) If you have a stored procedure and you want to optimise it you can call exec proc1, you could also use define/set for each of the variables and copy the code into query analyser, this then makes it easier to tune. However the optimiser works differently for these variables than it does for variables passed into the query via exec and will produce a less optimal plan |
|
(2) There is a different optimiser used in query analyser than that used otherwise? A colleague had a problem where a stored procedure called from dotnet code was running slowly but one run from query analyser via exec, with exactly the same arguments, was running quickly |
#3
| |||
| |||
|
|
There is some truth here. When the value of the parameters is available to the optimizer at compile time |
|
There is only one optimizer. Under some circumstances multiple execution plans can be cached for the same stored procedure. |
#4
| |||
| |||
|
|
There is some truth here. When the value of the parameters is available to the optimizer at compile time but what I mean is not the parameters, but something like this declare @var int set @var = 1 select * from table where somecolumn=@var as opposed to a stored procedure where @var is a parameter ... p217 (dug this out), it just seems very odd though, I can't understand why this would be the case so I could not be understanding this correctly. |
|
There is only one optimizer. Under some circumstances multiple execution plans can be cached for the same stored procedure. what sort of circumstances? |
#5
| |||
| |||
|
|
There is some truth here. When the value of the parameters is available to the optimizer at compile time but what I mean is not the parameters, but something like this declare @var int set @var = 1 select * from table where somecolumn=@var as opposed to a stored procedure where @var is a parameter |
|
I'd be interested in knowing what Oracle\mySQL do. |
![]() |
| Thread Tools | |
| Display Modes | |
| |