diff --git a/samples/features/intelligent-query-processing/Intelligent QP Demos Enlarging WideWorldImportersDW.sql b/samples/features/intelligent-query-processing/Intelligent QP Demos Enlarging WideWorldImportersDW.sql index 842613ba..9ebea812 100644 --- a/samples/features/intelligent-query-processing/Intelligent QP Demos Enlarging WideWorldImportersDW.sql +++ b/samples/features/intelligent-query-processing/Intelligent QP Demos Enlarging WideWorldImportersDW.sql @@ -100,4 +100,10 @@ GO UPDATE Fact.OrderHistoryExtended SET [WWI Order ID] = [Order Key]; +GO + +-- Repeat until log shrinks +CHECKPOINT +GO +DBCC SHRINKFILE (N'WWI_Log' , 0, TRUNCATEONLY) GO \ No newline at end of file diff --git a/samples/features/intelligent-query-processing/Intelligent QP Demos WideWorldImportersDW Public Preview - Interleaved Execution.sql b/samples/features/intelligent-query-processing/Intelligent QP Demos WideWorldImportersDW Public Preview - Interleaved Execution.sql index eb2c1161..176bf13a 100644 --- a/samples/features/intelligent-query-processing/Intelligent QP Demos WideWorldImportersDW Public Preview - Interleaved Execution.sql +++ b/samples/features/intelligent-query-processing/Intelligent QP Demos WideWorldImportersDW Public Preview - Interleaved Execution.sql @@ -17,7 +17,7 @@ USE [WideWorldImportersDW]; GO -CREATE FUNCTION [Fact].[WhatIfOutlierEventQuantity](@event VARCHAR(15), @beginOrderDateKey DATE, @endOrderDateKey DATE) +CREATE OR ALTER FUNCTION [Fact].[ufn_WhatIfOutlierEventQuantity](@event VARCHAR(15), @beginOrderDateKey DATE, @endOrderDateKey DATE) RETURNS @OutlierEventQuantity TABLE ( [Order Key] [bigint], [City Key] [int] NOT NULL, @@ -122,10 +122,10 @@ GO USE [WideWorldImportersDW]; GO -SELECT [fo].[Order Key], [fo].[Description], [fo].[Package], +SELECT [fo].[Order Key], [fo].[Description], [fo].[Package], [fo].[Quantity], [foo].[OutlierEventQuantity] -FROM [Fact].[Order] AS [fo] -INNER JOIN [Fact].[WhatIfOutlierEventQuantity]('Mild Recession', +FROM [Fact].[Order] AS [fo] +INNER JOIN [Fact].[ufn_WhatIfOutlierEventQuantity]('Mild Recession', '1-01-2013', '10-15-2014') AS [foo] ON [fo].[Order Key] = [foo].[Order Key] AND [fo].[City Key] = [foo].[City Key] @@ -137,7 +137,7 @@ INNER JOIN [Fact].[WhatIfOutlierEventQuantity]('Mild Recession', AND [fo].[Picker Key] = [foo].[Picker Key] INNER JOIN [Dimension].[Stock Item] AS [si] ON [fo].[Stock Item Key] = [si].[Stock Item Key] -WHERE [si].[Lead Time Days] > 0 +WHERE [si].[Lead Time Days] > 0 AND [fo].[Quantity] > 50; GO @@ -153,10 +153,10 @@ GO USE [WideWorldImportersDW]; GO -SELECT [fo].[Order Key], [fo].[Description], [fo].[Package], +SELECT [fo].[Order Key], [fo].[Description], [fo].[Package], [fo].[Quantity], [foo].[OutlierEventQuantity] -FROM [Fact].[Order] AS [fo] -INNER JOIN [Fact].[WhatIfOutlierEventQuantity]('Mild Recession', +FROM [Fact].[Order] AS [fo] +INNER JOIN [Fact].[ufn_WhatIfOutlierEventQuantity]('Mild Recession', '1-01-2013', '10-15-2014') AS [foo] ON [fo].[Order Key] = [foo].[Order Key] AND [fo].[City Key] = [foo].[City Key] @@ -168,6 +168,6 @@ INNER JOIN [Fact].[WhatIfOutlierEventQuantity]('Mild Recession', AND [fo].[Picker Key] = [foo].[Picker Key] INNER JOIN [Dimension].[Stock Item] AS [si] ON [fo].[Stock Item Key] = [si].[Stock Item Key] -WHERE [si].[Lead Time Days] > 0 +WHERE [si].[Lead Time Days] > 0 AND [fo].[Quantity] > 50; GO diff --git a/samples/features/intelligent-query-processing/Intelligent QP Demos WideWorldImportersDW Public Preview - Scalar UDF Inlining.sql b/samples/features/intelligent-query-processing/Intelligent QP Demos WideWorldImportersDW Public Preview - Scalar UDF Inlining.sql index e5b2124a..c6e687e7 100644 --- a/samples/features/intelligent-query-processing/Intelligent QP Demos WideWorldImportersDW Public Preview - Scalar UDF Inlining.sql +++ b/samples/features/intelligent-query-processing/Intelligent QP Demos WideWorldImportersDW Public Preview - Scalar UDF Inlining.sql @@ -26,7 +26,7 @@ Adapted from SQL Server Books Online https://docs.microsoft.com/sql/relational-databases/user-defined-functions/scalar-udf-inlining?view=sqlallproducts-allversions */ CREATE OR ALTER FUNCTION - dbo.customer_category(@CustomerKey INT) + dbo.ufn_customer_category(@CustomerKey INT) RETURNS CHAR(10) AS BEGIN DECLARE @total_amount DECIMAL(18,2); @@ -48,20 +48,25 @@ BEGIN END GO +SELECT * FROM sys.sql_modules +WHERE object_id = OBJECT_ID('ufn_customer_category') +GO + -- Before (show actual query execution plan for legacy behavior) SELECT TOP 100 [Customer Key], [Customer], - dbo.customer_category([Customer Key]) AS [Discount Price] + dbo.ufn_customer_category([Customer Key]) AS [Discount Price] FROM [Dimension].[Customer] ORDER BY [Customer Key] OPTION (RECOMPILE,USE HINT('DISABLE_TSQL_SCALAR_UDF_INLINING')); +GO -- After (show actual query execution plan for Scalar UDF Inlining) SELECT TOP 100 [Customer Key], [Customer], - dbo.customer_category([Customer Key]) AS [Discount Price] + dbo.ufn_customer_category([Customer Key]) AS [Discount Price] FROM [Dimension].[Customer] ORDER BY [Customer Key] OPTION (RECOMPILE); - +GO diff --git a/samples/features/intelligent-query-processing/Intelligent QP Demos WideWorldImportersDW Public Preview - TVDC.sql b/samples/features/intelligent-query-processing/Intelligent QP Demos WideWorldImportersDW Public Preview - TVDC.sql index 6277b4a1..e1a405dd 100644 --- a/samples/features/intelligent-query-processing/Intelligent QP Demos WideWorldImportersDW Public Preview - TVDC.sql +++ b/samples/features/intelligent-query-processing/Intelligent QP Demos WideWorldImportersDW Public Preview - TVDC.sql @@ -13,7 +13,7 @@ USE [master]; GO -ALTER DATABASE [WideWorldImportersDW] SET COMPATIBILITY_LEVEL = 150; +ALTER DATABASE [WideWorldImportersDW] SET COMPATIBILITY_LEVEL = 140; GO ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE; @@ -30,7 +30,7 @@ DECLARE @Order TABLE INSERT @Order SELECT [Order Key], [Quantity] FROM [Fact].[OrderHistory] -WHERE [Quantity] > 1; +WHERE [Quantity] > 99; -- Look at estimated rows, speed, join algorithm SELECT oh.[Order Key], oh.[Order Date Key], diff --git a/samples/features/query-store/QueryStoreSimpleDemo.exe b/samples/features/query-store/QueryStoreSimpleDemo.exe index d2611cff..e3c4fbe8 100644 Binary files a/samples/features/query-store/QueryStoreSimpleDemo.exe and b/samples/features/query-store/QueryStoreSimpleDemo.exe differ