Quantcast
Channel: Forum SQL Server Database Engine
Viewing all articles
Browse latest Browse all 15889

Table Valued Function running slow when called from SP

$
0
0

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


Viewing all articles
Browse latest Browse all 15889

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>