Warning: Constant WP_TEMP_DIR already defined in /var/www/html/blogs/joe/wp-config.php on line 93

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902
{"id":1172,"date":"2014-03-20T09:21:12","date_gmt":"2014-03-20T16:21:12","guid":{"rendered":"http:\/\/3.209.169.194\/blogs\/joe\/?p=1172"},"modified":"2014-03-20T09:26:57","modified_gmt":"2014-03-20T16:26:57","slug":"mstvf-fixed-cardinality-value-sql-server-2014","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/joe\/mstvf-fixed-cardinality-value-sql-server-2014\/","title":{"rendered":"MSTVF Fixed Cardinality Value in SQL Server 2014"},"content":{"rendered":"

In SQL Server 2014 CTP2 in the AdventureWorks2012 database, execute the following batch:<\/p>\n

 \r\nUSE [AdventureWorks2012];\r\nGO\r\n\r\nSELECT [PersonID], [FirstName], [LastName], [JobTitle], [BusinessEntityType]\r\nFROM [dbo].[ufnGetContactInformation](2)\r\nOPTION (QUERYTRACEON 9481);\u00a0 -- Legacy CE\r\n\r\nSELECT [PersonID], [FirstName], [LastName], [JobTitle], [BusinessEntityType]\r\nFROM [dbo].[ufnGetContactInformation](2)\r\nOPTION (QUERYTRACEON 2312); -- New CE\r\n<\/pre>\n

The first query uses the legacy cardinality estimator and the second query uses the new cardinality estimator.\u00a0\u00a0 Both queries are referencing a multi-statement table valued function.<\/p>\n

Looking at the plan tree view in SQL Sentry Plan Explorer for the legacy CE plan, you\u2019ll see the following (estimating 1 row for the function operators):<\/p>\n

\"image\"<\/a><\/p>\n

Looking at the new CE version of the plan tree, we see the following (estimating 100 rows<\/em> for the function operators):<\/p>\n

\"image\"<\/a><\/p>\n

SQL Server 2014 uses a new default fixed cardinality for multi-statement table valued functions.<\/p>\n

A few thoughts:<\/p>\n