Hi everybody,
I have this SP that calls a table-valued function whose execution is really slow (10 seconds for 4000 rows).
I noticed a strange behavior: if I run the SP I get the results in 10 seconds.
On the other hand, If I run the function before (just do right click -> Modify -> the script appears in a new query window -> I don't change anything, just execute the function) and then go back to SP and execute the SP it runs in 1-2 seconds.
I don't understand this behavior. Did someone meet with this issue before ?
I modified then the SP and added the 'WITH RECOMPILE' option so that I could force the SP run a new execution plan every time it is getting executed, but with no luck.
Maybe you have other solutions?
Thanks,
Andrei