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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 actual execution for a function

Author  Topic 

shaggy
Posting Yak Master

248 Posts

Posted - 2011-02-23 : 07:29:19
Pops,

I could not able to find actual execution for a function.is there any way to get that and when i closely analyze cpu utilization is high when using function.can anyone please advice for this behaviour.

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2011-02-23 : 07:49:30
you could use profiler. Probably the best way to do it.

Or -- if you know the code that is causing the problem (or you have a high degree of suspicion) you could grab it, run the code in management studio and look at the execution plan.

Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page

shaggy
Posting Yak Master

248 Posts

Posted - 2011-02-23 : 08:07:00
Thanks for reply charlie,

when i execute the function with actual execution plan on i could not able to get the exact plan and i could not able to find the query plan for underlying select statement. is there any other way to find
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2011-02-23 : 10:35:16
yeah -- extract the logic from the function -- set it up in script form. give it parameters. Then run it.

Or just have a look at the code -- chances are there's something in there (a loop maybe) that can be rewritten.

Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page

shaggy
Posting Yak Master

248 Posts

Posted - 2011-02-24 : 00:11:56
charlie i want to know whether plan will be generated for functions bcoz when using function cpu utilization is very high.i think plan will not be generated .i dont know the exact inner thing, can u put some light on this.
Go to Top of Page

mmarovic
Aged Yak Warrior

518 Posts

Posted - 2011-02-24 : 08:24:32
How about posting the code of your function?

Mirko

My blog: http://mirko-marovic-eng.blogspot.com/
Go to Top of Page
   

- Advertisement -