I have been experiencing some wierd udf behaviour.
I have a udf that takes 7.5 mins to run. The sql inside the udf runs in < 1s.
Run the query under index tuning wizard and it suggests a very odd index.
Adding the index gets the time for both down to < 1s.
I have a second udf that is not as condusive to the index tuning wizard.