September 21, 2004 05:21 PM

Query Analyzer Doesn't Accurately Report I/O for UDFs

Rating: (0)
SQL Server Magazine
InstantDoc ID #43898
In the Q&A "SQL Server Tools Return Different Results," above (InstantDoc ID 43897), I explain that different SQL Server tools report performance information in different ways based on how they calculate the metrics they measure. In most cases, minor discrepancies in the data that different SQL Server tools report don't matter. However, wrong answers lead to poor query-tuning decisions. And you can get a wrong answer if you're using Query Analyzer to analyze I/O for a query that includes a user-defined function (UDF).

Con...

...This article is for paid Professional Members only.

Already a Professional Member? Please log in now:

NOT A PROFESSIONAL MEMBER? YOU CHOOSE:

Professional Membership

Monthly

Annual

VIP Membership

Monthly

Annual

Add a Comment

This is really Sharon Dooley. I have had trouble converting my customer ID to a SQL mag userid. I support what Brian has written. I have some apalling examples where scalar UDFs that do data base access generate thousands of IOs. You will see these in Profiler, but you will not see them with STATISTICS IO and you will not see them in the query plan. Intuitively, one expects UDFs to behave like stored procedures with cached plans and costing. However, this is not the case. In fact, the only functions for which plans are developed and costed are in-line table-valued functions. In SQL
Server 2005 the references to a UDF will show up in the query plan but they will not be costed (per Microsoft). I believe that the only "safe" function (from a performance point of view) is an in-line table-valued function.



Anonymous User 10/28/2004 7:52:12 PM


You must log on before posting a comment.

Are you a new visitor? Register Here
GOOGLE LINKS
SPONSORED LINKS
FEATURED LINKS