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.
Author |
Topic |
markj11
Starting Member
17 Posts |
Posted - 2008-10-15 : 15:45:17
|
I have a sp that is taking 18 minutes to return 6500 rows. I can take the sql out of the sp and declare/set the parameters and it takes 1 second. I am mainly involved in sql2005 which this sp works fine, so I don't know were to begin with this? |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2008-10-15 : 15:51:03
|
you can begin with showing us the sp...WebfredPlanning replaces chance by mistake |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-10-15 : 15:52:43
|
Parameter sniffing? E 12°55'05.63"N 56°04'39.26" |
 |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2008-10-15 : 16:09:46
|
Yes maybe.We can see if OP shows sp and it's not using local vars.good night for now!WebfredPlanning replaces chance by mistake |
 |
|
markj11
Starting Member
17 Posts |
Posted - 2008-10-16 : 13:30:55
|
Sorry. I ended up assigning the parameters to local variables which caused the sp to execute in 2 seconds. I don't quite understand the logic behind this solution. When should this be done? I read that the execution plan gets screwed up but even flushing the cache would not solve the problem. |
 |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
|
|
|
|