{"id":498,"date":"2011-11-08T03:00:26","date_gmt":"2011-11-08T08:00:26","guid":{"rendered":"http:\/\/sqlity.net\/en\/?p=498"},"modified":"2014-11-13T14:02:43","modified_gmt":"2014-11-13T19:02:43","slug":"t-sql-tuesday-24-prox-n-funx","status":"publish","type":"post","link":"https:\/\/sqlity.net\/en\/498\/t-sql-tuesday-24-prox-n-funx\/","title":{"rendered":"T-SQL Tuesday #24 &#8211; Prox \u2018n\u2019 Funx"},"content":{"rendered":"<div style=\"position:relative;\">\n<div style=\"float:right;\">\n<a href=\"http:\/\/bradsruminations.blogspot.com\/2011\/10\/invitation-for-t-sql-tuesday-024-prox-n.html\"><strong><img loading=\"lazy\" decoding=\"async\" style=\"background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;float:right;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;\" title=\"T-SQL Tuesday\" border=\"0\" alt=\"T-SQL Tuesday\" align=\"right\" src=\"http:\/\/images.sqlity.net\/SqlTuesday.png\" width=\"132\" height=\"131\" \/><\/strong><\/a>\n<\/div>\n<p>\nIt is T-SQL Tuesday again, number 24 about procedures and functions, hosted by Brad Schulz (<a href=\"http:\/\/bradsruminations.blogspot.com\/\">Blog<\/a>|no twitter).\n<\/p>\n<h4>Performance Comparisons of different types of Functions<\/h4>\n<p>\n  A lot has been written about the performanmce impact of functions.<br \/>\n  Amongst other effects, functions used in a WHERE clause will prevent the use of an index seek for the columns involved.\n<\/p>\n<p>\n  Sometimes however it makes sense to use functions to encapsulate a complicated calculation or to make code reuse possible.<br \/>\n  It is therefore important that to understand just how big the impact is, that functions have on queries.\n<\/p>\n<p>\n  I would like to use this blog post to look at the call overhead of different kinds of functions in SQL Server.\n<\/p>\n<p>\n  SQL Server knows three types of functions: Scalar Functions, Inline Table-Valued Functions and Multi Statement Table-Valued Functions.<br \/>\n  There are also Scalar and Table-Valued CLR Functions, but we will not be looking at those in this article.\n<\/p>\n<p>\n  To be able to look just at the overhead of the function call we will use a very simple calculation: 1 * value\n<\/p>\n<p>\n  All examples used in this post will select from a simple table:\n<\/p>\n[sql]\nCREATE TABLE dbo.tbl1<br \/>\n(<br \/>\n  id INT CONSTRAINT PK_tbl1 PRIMARY KEY CLUSTERED,<br \/>\n  data INT NOT NULL<br \/>\n);<br \/>\n[\/sql]  <\/p>\n<p>\nThis table has been initialized with 1000000 rows containing random values in the data column.\n<\/p>\n<p>\nAs a base line we will use the following SELECT statement:\n<\/p>\n[sql]\nSELECT * INTO #x FROM dbo.tbl1 WHERE (1*data) = 42;<br \/>\n[\/sql]\n<p>\nNote the use of \"(1*data)\" instead of just \"data\". This is the calculation we will implement<br \/>\nin the different functions and the use of the calculation in the baseline query has the same<br \/>\nimpact on index usage as a function call has: It effectively prevents a seek operation on<br \/>\nany existing index.<br \/>\nAlso note the \"INTO #x\". It prevents that the results have to be send back to the client<br \/>\neliminating the chance for any ASYNCH_NETWORK_IO waits to affect the outcome of this performance test.<br \/>\nInstead the results (if any) will be written to tempdb on the same machine.\n<\/p>\n<p>\nNow lets look at the three functions:\n<\/p>\n[sql]\nCREATE FUNCTION dbo.simpleSVF(@parm INT)<br \/>\nRETURNS INT<br \/>\nAS<br \/>\nBEGIN<br \/>\n  RETURN 1*@parm;<br \/>\nEND;<br \/>\nGO<br \/>\nCREATE FUNCTION dbo.simpleTVF(@parm INT)<br \/>\nRETURNS TABLE<br \/>\nAS<br \/>\nRETURN SELECT 1*@parm val;<br \/>\nGO<br \/>\nCREATE FUNCTION dbo.multiStmtTVF(@parm INT)<br \/>\nRETURNS @r TABLE(val INT)<br \/>\nAS<br \/>\nBEGIN<br \/>\n  INSERT INTO @r(val) VALUES(1*@parm);<br \/>\n  RETURN;<br \/>\nEND<br \/>\n[\/sql]\n<p>\n  They all implement the same calculation we saw above.<br \/>\n  The Scalar Function (simpleSVF) just returns the result of that calculation directly,<br \/>\n  while the two Table-Valued functions return a resultset with one column and one row,<br \/>\n  containing the calculation result.\n<\/p>\n<p>\n  To use the Scalar Function we can just replace the calculation with a call to the function.<br \/>\n  The use of a Table-Values Function in this context requires a little more work.<br \/>\n  There are two patterns that you can use: A correlated subquery or a CROSS APPLY.<br \/>\n  We will compare both of them:\n<\/p>\n[sql]\nSELECT * INTO #x FROM dbo.tbl1 WHERE (SELECT val FROM dbo.simpleTVF(data)) = 42;<br \/>\nSELECT * INTO #x FROM dbo.tbl1 t CROSS APPLY dbo.simpleTVF(t.data) f WHERE f.val = 42;<br \/>\n[\/sql]\n<p>\n  The same two call patterns will also be used for the Multi Statement Table-Valued function.\n<\/p>\n<p>\n  To record the execution times I created a small stored procedure that uses the information<br \/>\n  in sys.dm_exec_requests together with the SYSDATETIME() function for it's measurements:\n<\/p>\n[sql]\nCREATE PROCEDURE dbo.RunTest<br \/>\n  @cid INT,<br \/>\n  @cmd NVARCHAR(MAX)<br \/>\nAS<br \/>\nBEGIN<br \/>\n  DECLARE @duration1 DATETIME2 ;<br \/>\n  DECLARE @duration2 DATETIME2 ;<br \/>\n  DECLARE @cpu1 INT ;<br \/>\n  DECLARE @cpu2 INT ;<br \/>\n  DECLARE @reads1 INT ;<br \/>\n  DECLARE @reads2 INT ;<\/p>\n<p>  DBCC DROPCLEANBUFFERS ;<br \/>\n  DBCC FREEPROCCACHE ;<br \/>\n  SELECT  @duration1 = SYSDATETIME() ,<br \/>\n          @cpu1 = cpu_time ,<br \/>\n          @reads1 = logical_reads<br \/>\n  FROM    sys.dm_exec_requests<br \/>\n  WHERE   session_id = @@SPID ;<\/p>\n<p>  EXEC(@cmd) ;<\/p>\n<p>  SELECT  @duration2 = SYSDATETIME() ,<br \/>\n          @cpu2 = cpu_time ,<br \/>\n          @reads2 = logical_reads<br \/>\n  FROM    sys.dm_exec_requests<br \/>\n  WHERE   session_id = @@SPID ;<\/p>\n<p>  INSERT INTO dbo.TestResults(cid,StartDTime,Duration,CPU,LogicalReads,Cmd)<br \/>\n  SELECT  @cid,<br \/>\n          @duration1,<br \/>\n          DATEDIFF(microsecond, @duration1, @duration2),<br \/>\n          @cpu2 - @cpu1,<br \/>\n          @reads2 - @reads1,<br \/>\n          @cmd;<br \/>\nEND;<br \/>\n[\/sql]\n<p>\n  This procedure executes the passed in command and records the execution time in microseconds,<br \/>\n  the time spend working on any CPU in milliseconds(!) as well as the logical reads in pages.<br \/>\n  It also clears out the buffer cache as well as the procedure cache each time before<br \/>\n  executing the statement. (So don't run this in production!)\n<\/p>\n<p>\n  The first parameter passed in is the command id (cid) and it is not used by the procedure itself,<br \/>\n  it is just stored together with the results. The 6 different calls to this procedure are listed below:\n<\/p>\n[sql]\nEXEC dbo.RunTest 1,'SELECT * INTO #x FROM dbo.tbl1 WHERE (1*data) = 42;';<br \/>\nEXEC dbo.RunTest 2,'SELECT * INTO #x FROM dbo.tbl1 WHERE dbo.simpleSVF(data) = 42;';<br \/>\nEXEC dbo.RunTest 3,'SELECT * INTO #x FROM dbo.tbl1 WHERE (SELECT val FROM dbo.simpleTVF(data)) = 42;';<br \/>\nEXEC dbo.RunTest 4,'SELECT * INTO #x FROM dbo.tbl1 t CROSS APPLY dbo.simpleTVF(t.data) f WHERE f.val = 42;';<br \/>\nEXEC dbo.RunTest 5,'SELECT * INTO #x FROM dbo.tbl1 WHERE (SELECT val FROM dbo.multiStmtTVF(data)) = 42;';<br \/>\nEXEC dbo.RunTest 6,'SELECT * INTO #x FROM dbo.tbl1 t CROSS APPLY dbo.multiStmtTVF(t.data) f WHERE f.val = 42;';<br \/>\n[\/sql]\n<p>\nAfter execution the first four 100 times each<br \/>\nand the last two 10 times each on my system I got the following numbers (average per execution):\n<\/p>\n<table>\n<tr>\n<td>ExecCount<\/td>\n<td>Duration<\/td>\n<td>CPU<\/td>\n<td>LogicalReads<\/td>\n<td>Cmd<\/td>\n<\/tr>\n<tr>\n<td>100<\/td>\n<td>725,781<\/td>\n<td>219<\/td>\n<td>2,296<\/td>\n<td>SELECT * INTO #x FROM dbo.tbl1 WHERE (1*data) = 42;<\/td>\n<\/tr>\n<tr>\n<td>100<\/td>\n<td>3,007,272<\/td>\n<td>2,702<\/td>\n<td>2,400<\/td>\n<td>SELECT * INTO #x FROM dbo.tbl1 WHERE dbo.simpleSVF(data) = 42;<\/td>\n<\/tr>\n<tr>\n<td>100<\/td>\n<td>708,660<\/td>\n<td>209<\/td>\n<td>2,283<\/td>\n<td>SELECT * INTO #x FROM dbo.tbl1 WHERE (SELECT val FROM dbo.simpleTVF(data)) = 42;<\/td>\n<\/tr>\n<tr>\n<td>100<\/td>\n<td>715,560<\/td>\n<td>211<\/td>\n<td>2,290<\/td>\n<td>SELECT * INTO #x FROM dbo.tbl1 t CROSS APPLY dbo.simpleTVF(t.data) f WHERE f.val = 42<\/td>\n<\/tr>\n<tr>\n<td>10<\/td>\n<td>112,347,425<\/td>\n<td>109,412<\/td>\n<td>33,984,827<\/td>\n<td>SELECT * INTO #x FROM dbo.tbl1 WHERE (SELECT val FROM dbo.multiStmtTVF(data)) = 42;<\/td>\n<\/tr>\n<tr>\n<td>10<\/td>\n<td>109,809,480<\/td>\n<td>107,776<\/td>\n<td>33,984,881<\/td>\n<td>SELECT * INTO #x FROM dbo.tbl1 t CROSS APPLY dbo.multiStmtTVF(t.data) f WHERE f.val = 42<\/td>\n<\/tr>\n<\/table>\n<p>\nAs you can see, there is almost no difference between the baseline and the two<br \/>\nusages of the Inline Table-Valued Function.<br \/>\nThe Scalar Function on the other hand took more than four times as long. Most of that time<br \/>\n(2.7 of 3 seconds) was spend actually using the processor. There were also about 100 more pages read.\n<\/p>\n<p>\nNow lets look at the Multi Statement Table-Valued Function.<br \/>\nI had to stop its execution after just 10 rounds to get the results in before Tuesday.<br \/>\nThis function slows the query by a factor of over 150.\n<\/p>\n<p>\nThis is caused by the fact that a Multi Statement Table-Valued Function uses a<br \/>\ntable variable to collect the rows.<br \/>\nTo create a table variable - similar to any other table - at least two pages<br \/>\nneed to be reserved as well as several changes to system tables<br \/>\nand internal database pages need to be performed.<br \/>\nThat all needs to be undone once the function finished executing.\n<\/p>\n<p>\nIn both queries above, the function gets executed for every row &mdash; 1,000,000 times in this case. This is causing all that table setup and destroy work to be executed 1,000,000 times as well.\n<\/p>\n<h4>Conclusion<\/h4>\n<p>\nIf you find yourself in a situation that lends itself to the use of a function,<br \/>\ntry to go with an Inlined Table-Valued Function as there is almost no performance impact.<br \/>\nHowever, always remeber that this blog post did not look into the impact that a function has on index usage.\n<\/p>\n<p>\nUnless you are writing a function that is going to be executed only rarely, stay away<br \/>\nfrom Multi Statement Table-Valued Functions.<\/p>\n","protected":false},"excerpt":{"rendered":"<h4>Performance Comparisons of different types of Functions<\/h4>\n<p>\n  A lot has been written about the performanmce impact of functions.<br \/>\n  Amongst other effects, functions used in a WHERE clause will prevent the use of an index seek for the columns involved.\n<\/p>\n<p>\n  Sometimes however it makes sense to use functions to encapsulate a complicated calculation or to make code reuse possible.<br \/>\n  It is therefore important that to understand just how big the impact is, that functions have on queries.\n<\/p>\n<p>\n  I would like to use this blog post to look at the call overhead of different kinds of functions in SQL Server.\n<\/p>\n<p> <a href=\"https:\/\/sqlity.net\/en\/498\/t-sql-tuesday-24-prox-n-funx\/\">[more&#8230;]<\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[5,13],"tags":[],"class_list":["post-498","post","type-post","status-publish","format-standard","hentry","category-general","category-t-sql-tuesday"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Performance Comparisons of different types of Functions<\/title>\n<meta name=\"description\" content=\"An in-depth look into the overhead of using a function in a SQL Server SELECT statement.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/sqlity.net\/en\/498\/t-sql-tuesday-24-prox-n-funx\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Performance Comparisons of different types of Functions\" \/>\n<meta property=\"og:description\" content=\"An in-depth look into the overhead of using a function in a SQL Server SELECT statement.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/sqlity.net\/en\/498\/t-sql-tuesday-24-prox-n-funx\/\" \/>\n<meta property=\"og:site_name\" content=\"sqlity.net\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/sqlity.net\" \/>\n<meta property=\"article:published_time\" content=\"2011-11-08T08:00:26+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-11-13T19:02:43+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/images.sqlity.net\/SqlTuesday.png\" \/>\n<meta name=\"author\" content=\"Sebastian Meine\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@sqlity\" \/>\n<meta name=\"twitter:site\" content=\"@sqlity\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sebastian Meine\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/498\\\/t-sql-tuesday-24-prox-n-funx\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/498\\\/t-sql-tuesday-24-prox-n-funx\\\/\"},\"author\":{\"name\":\"Sebastian Meine\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#\\\/schema\\\/person\\\/bcffd8c572bc2f1bd10fdba80135e53c\"},\"headline\":\"T-SQL Tuesday #24 &#8211; Prox \u2018n\u2019 Funx\",\"datePublished\":\"2011-11-08T08:00:26+00:00\",\"dateModified\":\"2014-11-13T19:02:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/498\\\/t-sql-tuesday-24-prox-n-funx\\\/\"},\"wordCount\":1230,\"commentCount\":1,\"image\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/498\\\/t-sql-tuesday-24-prox-n-funx\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/images.sqlity.net\\\/SqlTuesday.png\",\"articleSection\":[\"General\",\"T-SQL Tuesday\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/sqlity.net\\\/en\\\/498\\\/t-sql-tuesday-24-prox-n-funx\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/498\\\/t-sql-tuesday-24-prox-n-funx\\\/\",\"url\":\"https:\\\/\\\/sqlity.net\\\/en\\\/498\\\/t-sql-tuesday-24-prox-n-funx\\\/\",\"name\":\"Performance Comparisons of different types of Functions\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/498\\\/t-sql-tuesday-24-prox-n-funx\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/498\\\/t-sql-tuesday-24-prox-n-funx\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/images.sqlity.net\\\/SqlTuesday.png\",\"datePublished\":\"2011-11-08T08:00:26+00:00\",\"dateModified\":\"2014-11-13T19:02:43+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#\\\/schema\\\/person\\\/bcffd8c572bc2f1bd10fdba80135e53c\"},\"description\":\"An in-depth look into the overhead of using a function in a SQL Server SELECT statement.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/498\\\/t-sql-tuesday-24-prox-n-funx\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/sqlity.net\\\/en\\\/498\\\/t-sql-tuesday-24-prox-n-funx\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/498\\\/t-sql-tuesday-24-prox-n-funx\\\/#primaryimage\",\"url\":\"http:\\\/\\\/images.sqlity.net\\\/SqlTuesday.png\",\"contentUrl\":\"http:\\\/\\\/images.sqlity.net\\\/SqlTuesday.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/498\\\/t-sql-tuesday-24-prox-n-funx\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/sqlity.net\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"T-SQL Tuesday #24 &#8211; Prox \u2018n\u2019 Funx\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/sqlity.net\\\/en\\\/\",\"name\":\"sqlity.net\",\"description\":\"Quality for SQL\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/sqlity.net\\\/en\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#\\\/schema\\\/person\\\/bcffd8c572bc2f1bd10fdba80135e53c\",\"name\":\"Sebastian Meine\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g\",\"caption\":\"Sebastian Meine\"},\"sameAs\":[\"http:\\\/\\\/sqlity.net\",\"https:\\\/\\\/x.com\\\/sqlity\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Performance Comparisons of different types of Functions","description":"An in-depth look into the overhead of using a function in a SQL Server SELECT statement.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/sqlity.net\/en\/498\/t-sql-tuesday-24-prox-n-funx\/","og_locale":"en_US","og_type":"article","og_title":"Performance Comparisons of different types of Functions","og_description":"An in-depth look into the overhead of using a function in a SQL Server SELECT statement.","og_url":"https:\/\/sqlity.net\/en\/498\/t-sql-tuesday-24-prox-n-funx\/","og_site_name":"sqlity.net","article_publisher":"https:\/\/www.facebook.com\/sqlity.net","article_published_time":"2011-11-08T08:00:26+00:00","article_modified_time":"2014-11-13T19:02:43+00:00","og_image":[{"url":"http:\/\/images.sqlity.net\/SqlTuesday.png","type":"","width":"","height":""}],"author":"Sebastian Meine","twitter_card":"summary_large_image","twitter_creator":"@sqlity","twitter_site":"@sqlity","twitter_misc":{"Written by":"Sebastian Meine","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/sqlity.net\/en\/498\/t-sql-tuesday-24-prox-n-funx\/#article","isPartOf":{"@id":"https:\/\/sqlity.net\/en\/498\/t-sql-tuesday-24-prox-n-funx\/"},"author":{"name":"Sebastian Meine","@id":"https:\/\/sqlity.net\/en\/#\/schema\/person\/bcffd8c572bc2f1bd10fdba80135e53c"},"headline":"T-SQL Tuesday #24 &#8211; Prox \u2018n\u2019 Funx","datePublished":"2011-11-08T08:00:26+00:00","dateModified":"2014-11-13T19:02:43+00:00","mainEntityOfPage":{"@id":"https:\/\/sqlity.net\/en\/498\/t-sql-tuesday-24-prox-n-funx\/"},"wordCount":1230,"commentCount":1,"image":{"@id":"https:\/\/sqlity.net\/en\/498\/t-sql-tuesday-24-prox-n-funx\/#primaryimage"},"thumbnailUrl":"http:\/\/images.sqlity.net\/SqlTuesday.png","articleSection":["General","T-SQL Tuesday"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/sqlity.net\/en\/498\/t-sql-tuesday-24-prox-n-funx\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/sqlity.net\/en\/498\/t-sql-tuesday-24-prox-n-funx\/","url":"https:\/\/sqlity.net\/en\/498\/t-sql-tuesday-24-prox-n-funx\/","name":"Performance Comparisons of different types of Functions","isPartOf":{"@id":"https:\/\/sqlity.net\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/sqlity.net\/en\/498\/t-sql-tuesday-24-prox-n-funx\/#primaryimage"},"image":{"@id":"https:\/\/sqlity.net\/en\/498\/t-sql-tuesday-24-prox-n-funx\/#primaryimage"},"thumbnailUrl":"http:\/\/images.sqlity.net\/SqlTuesday.png","datePublished":"2011-11-08T08:00:26+00:00","dateModified":"2014-11-13T19:02:43+00:00","author":{"@id":"https:\/\/sqlity.net\/en\/#\/schema\/person\/bcffd8c572bc2f1bd10fdba80135e53c"},"description":"An in-depth look into the overhead of using a function in a SQL Server SELECT statement.","breadcrumb":{"@id":"https:\/\/sqlity.net\/en\/498\/t-sql-tuesday-24-prox-n-funx\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/sqlity.net\/en\/498\/t-sql-tuesday-24-prox-n-funx\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/sqlity.net\/en\/498\/t-sql-tuesday-24-prox-n-funx\/#primaryimage","url":"http:\/\/images.sqlity.net\/SqlTuesday.png","contentUrl":"http:\/\/images.sqlity.net\/SqlTuesday.png"},{"@type":"BreadcrumbList","@id":"https:\/\/sqlity.net\/en\/498\/t-sql-tuesday-24-prox-n-funx\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/sqlity.net\/en\/"},{"@type":"ListItem","position":2,"name":"T-SQL Tuesday #24 &#8211; Prox \u2018n\u2019 Funx"}]},{"@type":"WebSite","@id":"https:\/\/sqlity.net\/en\/#website","url":"https:\/\/sqlity.net\/en\/","name":"sqlity.net","description":"Quality for SQL","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/sqlity.net\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/sqlity.net\/en\/#\/schema\/person\/bcffd8c572bc2f1bd10fdba80135e53c","name":"Sebastian Meine","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g","caption":"Sebastian Meine"},"sameAs":["http:\/\/sqlity.net","https:\/\/x.com\/sqlity"]}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2wXuw-82","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/posts\/498","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/comments?post=498"}],"version-history":[{"count":0,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/posts\/498\/revisions"}],"wp:attachment":[{"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/media?parent=498"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/categories?post=498"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/tags?post=498"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}