{
"metadata": {
"kernelspec": {
"name": "SQL",
"display_name": "SQL",
"language": "sql"
},
"language_info": {
"name": "sql",
"version": ""
}
},
"nbformat_minor": 2,
"nbformat": 4,
"cells": [
{
"cell_type": "markdown",
"source": [
"# Batch Mode on rowstore\r\n",
"Batch mode on rowstore enables batch mode execution for analytic workloads without requiring columnstore indexes. This feature supports batch mode execution and bitmap filters for on-disk heaps and B-tree indexes. Batch mode on rowstore enables support for all existing batch mode-enabled operators. Batch mode on Rowstore is a feature under the [**Intelligent Query Processing**](https://aka.ms/iqp) suite of features. \r\n",
"\r\n",
"This example will show you how upgrading to **Database Compatibility Level = 150** could improve performance of the following workloads due to batch mode on rowstore:\r\n",
"* A significant part of the workload consists of analytical queries. Usually, these queries have operators like joins or aggregates that process hundreds of thousands of rows or more.\r\n",
"* The workload is CPU bound. If the bottleneck is I/O, we still recommend that you consider a columnstore index, if possible.\r\n",
"* Creating a columnstore index adds too much overhead to the transactional part of your workload. Or, creating a columnstore index isn't feasible because your application depends on a feature that's not yet supported with columnstore indexes.\r\n",
"\r\n",
"More information about this feature is available [here](https://docs.microsoft.com/en-us/sql/relational-databases/performance/intelligent-query-processing?view=sql-server-ver15#batch-mode-on-rowstore)."
],
"metadata": {
"azdata_cell_guid": "7870ea3f-b017-46d9-bec6-15369f4ade69"
}
},
{
"cell_type": "markdown",
"source": [
"**Step 1**: You could choose to use a container to evaluate this feature. Create an instance of SQL Server 2019 using a Docker image and restore the AdventureWorks database backup\r\n",
"\r\n",
"You will need the **WideWorldImportersDW** database for this exercise. If you don't have this sample database, then you download the sample database [here](https://github.com/Microsoft/sql-server-samples/releases/download/wide-world-importers-v1.0/WideWorldImportersDW-Full.bak \"WideWorldImportersDW-Full download\")\r\n",
"\r\n",
"Restore the copied WideWorldImportersDW database backup into the container and restore the backup.\r\n",
"\r\n",
"##### Docker Commands\r\n",
">docker pull mcr.microsoft.com/mssql/server:2019-latest\r\n",
"\r\n",
">docker run -e \"ACCEPT_EULA=Y\" -e \"SA_PASSWORD=`\" -p 1445:1433 --name sql2019demo -d mcr.microsoft.com/mssql/server:2019-latest\r\n",
"\r\n",
">docker cp \".\\Downloads\\WideWorldImportersDW-Full.bak\" sql2019demo:/var/opt/mssql/data\r\n",
""
],
"metadata": {
"azdata_cell_guid": "975f5a9f-300f-450b-8981-cebb9ed6c719"
}
},
{
"cell_type": "code",
"source": [
"-- Restore the AdventureWorks2017.bak file \r\n",
"declare @datafilepath varchar(8000) = CAST(SERVERPROPERTY('InstanceDefaultDataPath') as varchar(4000)) + 'WideWorldImportersDW.mdf'\r\n",
"declare @logfilepath varchar(8000) = CAST(SERVERPROPERTY('InstanceDefaultLogPath') as varchar(4000)) + 'WideWorldImportersDW.ldf'\r\n",
"declare @inmemfilepath varchar(8000) = CAST(SERVERPROPERTY('InstanceDefaultLogPath') as varchar(4000)) + 'WideWorldImportersDW_InMemory_Data_1'\r\n",
"declare @secondaryfilepath varchar(8000) = CAST(SERVERPROPERTY('InstanceDefaultLogPath') as varchar(4000))+ 'WideWorldImportersDW_2.ndf'\r\n",
"-- Replace the path with the appropriate file\r\n",
"declare @backupfile varchar(8000) = 'WideWorldImportersDW-Full.bak'\r\n",
"restore database WideWorldImportersDW\r\n",
"from disk = @backupfile\r\n",
"with move 'WWI_Primary' to @datafilepath,\r\n",
"move 'WWI_UserData' to @secondaryfilepath,\r\n",
"move 'WWIDW_InMemory_Data_1' to @inmemfilepath,\r\n",
"move 'WWI_Log' to @logfilepath,\r\n",
"stats = 10, REPLACE"
],
"metadata": {
"azdata_cell_guid": "b48b5a47-55d7-4c3c-ba51-2efa8d801029"
},
"outputs": [],
"execution_count": 7
},
{
"cell_type": "markdown",
"source": [
"**Step 2:** See scalar UDF performance issues using an example\r\n",
"The below query calls scalar UDFs to get the the list price and remaining stock of the products in the invetory. You will notice that it returns over 121,000 rows.\r\n",
""
],
"metadata": {
"azdata_cell_guid": "4e07d47f-3833-40dd-8203-1d43af8bacd8"
}
},
{
"cell_type": "code",
"source": [
"USE WideWorldImportersDW;\r\n",
"GO\r\n",
"\r\n",
"/*\r\n",
"Assumes a fresh restore of WideWorldImportersDW\r\n",
"*/\r\n",
"\r\n",
"IF OBJECT_ID('Fact.OrderHistory') IS NULL BEGIN\r\n",
" SELECT [Order Key], [City Key], [Customer Key], [Stock Item Key], [Order Date Key], [Picked Date Key], [Salesperson Key], [Picker Key], [WWI Order ID], [WWI Backorder ID], Description, Package, Quantity, [Unit Price], [Tax Rate], [Total Excluding Tax], [Tax Amount], [Total Including Tax], [Lineage Key]\r\n",
" INTO Fact.OrderHistory\r\n",
" FROM Fact.[Order];\r\n",
"END;\r\n",
"\r\n",
"ALTER TABLE Fact.OrderHistory\r\n",
"ADD CONSTRAINT PK_Fact_OrderHistory PRIMARY KEY NONCLUSTERED([Order Key] ASC, [Order Date Key] ASC)WITH(DATA_COMPRESSION=PAGE);\r\n",
"GO\r\n",
"\r\n",
"CREATE INDEX IX_Stock_Item_Key\r\n",
"ON Fact.OrderHistory([Stock Item Key])\r\n",
"INCLUDE(Quantity)\r\n",
"WITH(DATA_COMPRESSION=PAGE);\r\n",
"GO\r\n",
"\r\n",
"CREATE INDEX IX_OrderHistory_Quantity\r\n",
"ON Fact.OrderHistory([Quantity])\r\n",
"INCLUDE([Order Key])\r\n",
"WITH(DATA_COMPRESSION=PAGE);\r\n",
"GO\r\n",
"\r\n",
"\r\n",
"/*\r\n",
"\tReality check... Starting count should be 231,412\r\n",
"*/\r\n",
"\r\n",
"SELECT COUNT(*) FROM Fact.OrderHistory;\r\n",
"GO\r\n",
"/*\r\n",
"\tMake this table bigger (exec as desired)\r\n",
"\tNotice the \"GO 4\"\r\n",
"*/\r\n",
"\r\n",
"INSERT Fact.OrderHistory([City Key], [Customer Key], [Stock Item Key], [Order Date Key], [Picked Date Key], [Salesperson Key], [Picker Key], [WWI Order ID], [WWI Backorder ID], Description, Package, Quantity, [Unit Price], [Tax Rate], [Total Excluding Tax], [Tax Amount], [Total Including Tax], [Lineage Key])\r\n",
"SELECT [City Key], [Customer Key], [Stock Item Key], [Order Date Key], [Picked Date Key], [Salesperson Key], [Picker Key], [WWI Order ID], [WWI Backorder ID], Description, Package, Quantity, [Unit Price], [Tax Rate], [Total Excluding Tax], [Tax Amount], [Total Including Tax], [Lineage Key]\r\n",
"FROM Fact.OrderHistory;\r\n",
"GO 4\r\n",
"\r\n",
"/*\r\n",
"\tShould be 3,702,592\r\n",
"*/\r\n",
"SELECT COUNT(*) FROM Fact.OrderHistory;\r\n",
"GO\r\n",
"\r\n",
"IF OBJECT_ID('Fact.OrderHistoryExtended') IS NULL BEGIN\r\n",
" SELECT [Order Key], [City Key], [Customer Key], [Stock Item Key], [Order Date Key], [Picked Date Key], [Salesperson Key], [Picker Key], [WWI Order ID], [WWI Backorder ID], Description, Package, Quantity, [Unit Price], [Tax Rate], [Total Excluding Tax], [Tax Amount], [Total Including Tax], [Lineage Key]\r\n",
" INTO Fact.OrderHistoryExtended\r\n",
" FROM Fact.[OrderHistory];\r\n",
"END;\r\n",
"\r\n",
"ALTER TABLE Fact.OrderHistoryExtended\r\n",
"ADD CONSTRAINT PK_Fact_OrderHistoryExtended PRIMARY KEY NONCLUSTERED([Order Key] ASC, [Order Date Key] ASC)\r\n",
"WITH(DATA_COMPRESSION=PAGE);\r\n",
"GO\r\n",
"\r\n",
"CREATE INDEX IX_Stock_Item_Key\r\n",
"ON Fact.OrderHistoryExtended([Stock Item Key])\r\n",
"INCLUDE(Quantity);\r\n",
"GO\r\n",
"\r\n",
"/*\r\n",
"\tShould be 3,702,592\r\n",
"*/\r\n",
"SELECT COUNT(*) FROM Fact.OrderHistoryExtended;\r\n",
"GO\r\n",
"\r\n",
"/*\r\n",
"\tMake this table bigger (exec as desired)\r\n",
"\tNotice the \"GO 3\"\r\n",
"*/\r\n",
"\r\n",
"INSERT Fact.OrderHistoryExtended([City Key], [Customer Key], [Stock Item Key], [Order Date Key], [Picked Date Key], [Salesperson Key], [Picker Key], [WWI Order ID], [WWI Backorder ID], Description, Package, Quantity, [Unit Price], [Tax Rate], [Total Excluding Tax], [Tax Amount], [Total Including Tax], [Lineage Key])\r\n",
"SELECT [City Key], [Customer Key], [Stock Item Key], [Order Date Key], [Picked Date Key], [Salesperson Key], [Picker Key], [WWI Order ID], [WWI Backorder ID], Description, Package, Quantity, [Unit Price], [Tax Rate], [Total Excluding Tax], [Tax Amount], [Total Including Tax], [Lineage Key]\r\n",
"FROM Fact.OrderHistoryExtended;\r\n",
"GO 3\r\n",
"\r\n",
"\r\n",
"/*\r\n",
"\tShould be 29,620,736\r\n",
"*/\r\n",
"\r\n",
"SELECT COUNT(*) FROM Fact.OrderHistoryExtended;\r\n",
"GO\r\n",
"\r\n",
"UPDATE Fact.OrderHistoryExtended\r\n",
"SET [WWI Order ID] = [Order Key];\r\n",
"GO\r\n",
"\r\n",
"-- Repeat until log shrinks\r\n",
"\r\n",
"CHECKPOINT\r\n",
"GO\r\n",
"\r\n",
""
],
"metadata": {
"azdata_cell_guid": "a7421321-3652-49c5-b83a-e25e69c48aed"
},
"outputs": [],
"execution_count": 3
},
{
"cell_type": "markdown",
"source": [
"**Step 3**: Execute the query without Batch Mode for Rowstore. This is done by using a query hint \"**DISALLOW_BATCH_MODE**\" to disable the feature."
],
"metadata": {
"azdata_cell_guid": "cc613f99-f3c2-462f-93df-bd197de31bbc"
}
},
{
"cell_type": "code",
"source": [
"USE [WideWorldImportersDW];\r\n",
"GO\r\n",
"ALTER DATABASE [WideWorldImportersDW] SET COMPATIBILITY_LEVEL = 150;\r\n",
"GO\r\n",
"\r\n",
"ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE;\r\n",
"GO\r\n",
"-- Row mode due to hint\r\n",
"SELECT\t[Tax Rate],\r\n",
"\t\t[Lineage Key],\r\n",
"\t\t[Salesperson Key],\r\n",
"\tSUM([Quantity])\t\t\t\t\tAS SUM_QTY,\r\n",
"\tSUM([Unit Price])\t\t\t\tAS SUM_BASE_PRICE,\r\n",
"\tCOUNT(*)\t\t\t\t\tAS COUNT_ORDER\r\n",
"FROM\t[Fact].[OrderHistoryExtended]\r\n",
"WHERE\t[Order Date Key]\t<= dateadd(dd, -73, '2015-11-13')\r\n",
"GROUP\tBY\t[Tax Rate],\r\n",
"\t\t[Lineage Key],\r\n",
"\t\t[Salesperson Key]\r\n",
"ORDER\tBY\t[Tax Rate],\r\n",
"\t\t[Lineage Key],\r\n",
"\t\t[Salesperson Key]\r\n",
"OPTION (RECOMPILE, USE HINT('DISALLOW_BATCH_MODE'));\r\n",
""
],
"metadata": {
"azdata_cell_guid": "71483984-6bdd-4866-8ddc-e40fe692c0db"
},
"outputs": [
{
"output_type": "display_data",
"data": {
"text/html": "Commands completed successfully."
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/html": "Commands completed successfully."
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/html": "Commands completed successfully."
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/html": "(100 rows affected)"
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/html": "Total execution time: 00:00:19.584"
},
"metadata": {}
},
{
"output_type": "execute_result",
"metadata": {},
"execution_count": 8,
"data": {
"application/vnd.dataresource+json": {
"schema": {
"fields": [
{
"name": "Tax Rate"
},
{
"name": "Lineage Key"
},
{
"name": "Salesperson Key"
},
{
"name": "SUM_QTY"
},
{
"name": "SUM_BASE_PRICE"
},
{
"name": "COUNT_ORDER"
}
]
},
"data": [
{
"0": "15.000",
"1": "9",
"2": "4",
"3": "433280",
"4": "243367.68",
"5": "9216"
},
{
"0": "15.000",
"1": "9",
"2": "6",
"3": "836480",
"4": "543988.48",
"5": "18432"
},
{
"0": "15.000",
"1": "9",
"2": "7",
"3": "724480",
"4": "846118.40",
"5": "24576"
},
{
"0": "15.000",
"1": "9",
"2": "8",
"3": "862080",
"4": "1028780.80",
"5": "22144"
},
{
"0": "15.000",
"1": "9",
"2": "9",
"3": "1101056",
"4": "924917.76",
"5": "28928"
},
{
"0": "15.000",
"1": "9",
"2": "11",
"3": "2279296",
"4": "3886913.28",
"5": "62848"
},
{
"0": "15.000",
"1": "9",
"2": "12",
"3": "3262592",
"4": "3852878.08",
"5": "85888"
},
{
"0": "15.000",
"1": "9",
"2": "15",
"3": "5484800",
"4": "6343098.88",
"5": "144256"
},
{
"0": "15.000",
"1": "9",
"2": "19",
"3": "91831040",
"4": "107590420.48",
"5": "2310528"
},
{
"0": "15.000",
"1": "9",
"2": "21",
"3": "1240960",
"4": "2060285.44",
"5": "37632"
},
{
"0": "15.000",
"1": "9",
"2": "23",
"3": "1003520",
"4": "1541052.16",
"5": "29696"
},
{
"0": "15.000",
"1": "9",
"2": "25",
"3": "2986624",
"4": "2914885.12",
"5": "73344"
},
{
"0": "15.000",
"1": "9",
"2": "26",
"3": "497536",
"4": "725172.48",
"5": "12416"
},
{
"0": "15.000",
"1": "9",
"2": "27",
"3": "598016",
"4": "798522.88",
"5": "14592"
},
{
"0": "15.000",
"1": "9",
"2": "28",
"3": "1233152",
"4": "1474490.88",
"5": "31488"
},
{
"0": "15.000",
"1": "9",
"2": "29",
"3": "387968",
"4": "304568.32",
"5": "10880"
},
{
"0": "15.000",
"1": "9",
"2": "30",
"3": "1549312",
"4": "2156144.64",
"5": "47232"
},
{
"0": "15.000",
"1": "9",
"2": "31",
"3": "2215296",
"4": "2227068.16",
"5": "50560"
},
{
"0": "15.000",
"1": "9",
"2": "35",
"3": "2724736",
"4": "3383616.00",
"5": "72960"
},
{
"0": "15.000",
"1": "9",
"2": "36",
"3": "11016320",
"4": "12551537.92",
"5": "276992"
},
{
"0": "15.000",
"1": "9",
"2": "38",
"3": "1519744",
"4": "1955315.20",
"5": "39552"
},
{
"0": "15.000",
"1": "9",
"2": "39",
"3": "31888384",
"4": "34617245.44",
"5": "785664"
},
{
"0": "15.000",
"1": "9",
"2": "40",
"3": "6807424",
"4": "7944593.92",
"5": "176896"
},
{
"0": "15.000",
"1": "9",
"2": "41",
"3": "2219136",
"4": "3174849.28",
"5": "63232"
},
{
"0": "15.000",
"1": "9",
"2": "45",
"3": "338176",
"4": "382839.04",
"5": "7808"
},
{
"0": "15.000",
"1": "9",
"2": "46",
"3": "112128",
"4": "111915.52",
"5": "2176"
},
{
"0": "15.000",
"1": "9",
"2": "47",
"3": "3255680",
"4": "2629954.56",
"5": "75776"
},
{
"0": "15.000",
"1": "9",
"2": "48",
"3": "2595968",
"4": "2310150.40",
"5": "60928"
},
{
"0": "15.000",
"1": "9",
"2": "49",
"3": "14758528",
"4": "17928881.92",
"5": "368768"
},
{
"0": "15.000",
"1": "9",
"2": "50",
"3": "804352",
"4": "926225.92",
"5": "19968"
},
{
"0": "15.000",
"1": "9",
"2": "51",
"3": "4007808",
"4": "4360591.36",
"5": "97408"
},
{
"0": "15.000",
"1": "9",
"2": "52",
"3": "5863424",
"4": "7464648.96",
"5": "156160"
},
{
"0": "15.000",
"1": "9",
"2": "54",
"3": "2736768",
"4": "3351491.84",
"5": "72320"
},
{
"0": "15.000",
"1": "9",
"2": "56",
"3": "285824",
"4": "253144.32",
"5": "7552"
},
{
"0": "15.000",
"1": "9",
"2": "57",
"3": "2298240",
"4": "2447610.88",
"5": "58240"
},
{
"0": "15.000",
"1": "9",
"2": "58",
"3": "2144768",
"4": "1723477.76",
"5": "50048"
},
{
"0": "15.000",
"1": "9",
"2": "61",
"3": "3732224",
"4": "4086886.40",
"5": "86016"
},
{
"0": "15.000",
"1": "9",
"2": "62",
"3": "12672128",
"4": "13904339.20",
"5": "304000"
},
{
"0": "15.000",
"1": "9",
"2": "63",
"3": "10126208",
"4": "10138237.44",
"5": "243200"
},
{
"0": "15.000",
"1": "9",
"2": "65",
"3": "6787456",
"4": "7473853.44",
"5": "171136"
},
{
"0": "15.000",
"1": "9",
"2": "68",
"3": "4638720",
"4": "4848647.68",
"5": "107008"
},
{
"0": "15.000",
"1": "9",
"2": "70",
"3": "14884864",
"4": "16764665.60",
"5": "379776"
},
{
"0": "15.000",
"1": "9",
"2": "72",
"3": "2565888",
"4": "2336160.00",
"5": "55936"
},
{
"0": "15.000",
"1": "9",
"2": "74",
"3": "15317888",
"4": "19187417.60",
"5": "384768"
},
{
"0": "15.000",
"1": "9",
"2": "76",
"3": "6481280",
"4": "8637446.40",
"5": "169088"
},
{
"0": "15.000",
"1": "9",
"2": "77",
"3": "7128320",
"4": "7693249.28",
"5": "169984"
},
{
"0": "15.000",
"1": "9",
"2": "78",
"3": "5061376",
"4": "5629213.44",
"5": "121856"
},
{
"0": "15.000",
"1": "9",
"2": "80",
"3": "7743104",
"4": "8722903.04",
"5": "203264"
},
{
"0": "15.000",
"1": "9",
"2": "81",
"3": "28808064",
"4": "32882525.44",
"5": "706048"
},
{
"0": "15.000",
"1": "9",
"2": "83",
"3": "12662272",
"4": "14586407.68",
"5": "330880"
},
{
"0": "15.000",
"1": "9",
"2": "84",
"3": "6509184",
"4": "8482062.08",
"5": "169856"
},
{
"0": "15.000",
"1": "9",
"2": "85",
"3": "4782592",
"4": "4991431.68",
"5": "116864"
},
{
"0": "15.000",
"1": "9",
"2": "86",
"3": "27021696",
"4": "30225996.80",
"5": "682624"
},
{
"0": "15.000",
"1": "9",
"2": "89",
"3": "1578752",
"4": "2027873.28",
"5": "36096"
},
{
"0": "15.000",
"1": "9",
"2": "90",
"3": "33806464",
"4": "39663014.40",
"5": "856704"
},
{
"0": "15.000",
"1": "9",
"2": "91",
"3": "4442752",
"4": "5842634.24",
"5": "112768"
},
{
"0": "15.000",
"1": "9",
"2": "93",
"3": "28200192",
"4": "33006179.84",
"5": "713984"
},
{
"0": "15.000",
"1": "9",
"2": "94",
"3": "12681600",
"4": "13601986.56",
"5": "303232"
},
{
"0": "15.000",
"1": "9",
"2": "96",
"3": "666624",
"4": "473141.76",
"5": "14464"
},
{
"0": "15.000",
"1": "9",
"2": "97",
"3": "11993088",
"4": "13300569.60",
"5": "303104"
},
{
"0": "15.000",
"1": "9",
"2": "101",
"3": "7575168",
"4": "7600646.40",
"5": "196992"
},
{
"0": "15.000",
"1": "9",
"2": "102",
"3": "27441920",
"4": "33995997.44",
"5": "703872"
},
{
"0": "15.000",
"1": "9",
"2": "103",
"3": "7057280",
"4": "8503637.76",
"5": "185088"
},
{
"0": "15.000",
"1": "9",
"2": "105",
"3": "29710848",
"4": "34073157.12",
"5": "735872"
},
{
"0": "15.000",
"1": "9",
"2": "106",
"3": "8104704",
"4": "9812775.68",
"5": "220416"
},
{
"0": "15.000",
"1": "9",
"2": "107",
"3": "2590464",
"4": "3028149.76",
"5": "61952"
},
{
"0": "15.000",
"1": "9",
"2": "108",
"3": "40156160",
"4": "45593496.32",
"5": "1001600"
},
{
"0": "15.000",
"1": "9",
"2": "115",
"3": "2452096",
"4": "2226137.60",
"5": "60800"
},
{
"0": "15.000",
"1": "9",
"2": "116",
"3": "23243392",
"4": "24868823.04",
"5": "564736"
},
{
"0": "15.000",
"1": "9",
"2": "118",
"3": "14240128",
"4": "15111184.64",
"5": "353408"
},
{
"0": "15.000",
"1": "9",
"2": "119",
"3": "40846720",
"4": "45264224.00",
"5": "1027456"
},
{
"0": "15.000",
"1": "9",
"2": "122",
"3": "6732544",
"4": "7716145.92",
"5": "164992"
},
{
"0": "15.000",
"1": "9",
"2": "126",
"3": "7082880",
"4": "8110862.08",
"5": "171008"
},
{
"0": "15.000",
"1": "9",
"2": "127",
"3": "24211712",
"4": "28525308.16",
"5": "616576"
},
{
"0": "15.000",
"1": "9",
"2": "129",
"3": "31437312",
"4": "34298964.48",
"5": "767488"
},
{
"0": "15.000",
"1": "9",
"2": "130",
"3": "390272",
"4": "315754.24",
"5": "10880"
},
{
"0": "15.000",
"1": "9",
"2": "134",
"3": "19598208",
"4": "22598796.80",
"5": "491520"
},
{
"0": "15.000",
"1": "9",
"2": "136",
"3": "357248",
"4": "296313.60",
"5": "9856"
},
{
"0": "15.000",
"1": "9",
"2": "138",
"3": "4697088",
"4": "5400261.12",
"5": "118144"
},
{
"0": "15.000",
"1": "9",
"2": "140",
"3": "17321984",
"4": "19747557.12",
"5": "433280"
},
{
"0": "15.000",
"1": "9",
"2": "143",
"3": "22007296",
"4": "26812788.48",
"5": "567040"
},
{
"0": "15.000",
"1": "9",
"2": "144",
"3": "7777664",
"4": "9402172.16",
"5": "193152"
},
{
"0": "15.000",
"1": "9",
"2": "145",
"3": "15399680",
"4": "17946855.68",
"5": "388096"
},
{
"0": "15.000",
"1": "9",
"2": "149",
"3": "2256896",
"4": "2663919.36",
"5": "60416"
},
{
"0": "15.000",
"1": "9",
"2": "150",
"3": "10869632",
"4": "12971114.24",
"5": "281344"
},
{
"0": "15.000",
"1": "9",
"2": "151",
"3": "11137920",
"4": "11154696.96",
"5": "269568"
},
{
"0": "15.000",
"1": "9",
"2": "152",
"3": "11700480",
"4": "13719448.32",
"5": "285056"
},
{
"0": "15.000",
"1": "9",
"2": "154",
"3": "8281344",
"4": "8556992.00",
"5": "212864"
},
{
"0": "15.000",
"1": "9",
"2": "155",
"3": "8951424",
"4": "9563397.12",
"5": "219264"
},
{
"0": "15.000",
"1": "9",
"2": "156",
"3": "6004608",
"4": "5900654.08",
"5": "152192"
},
{
"0": "15.000",
"1": "9",
"2": "158",
"3": "500480",
"4": "65113.60",
"5": "4352"
},
{
"0": "15.000",
"1": "9",
"2": "161",
"3": "253952",
"4": "56025.60",
"5": "2816"
},
{
"0": "15.000",
"1": "9",
"2": "163",
"3": "248320",
"4": "48179.20",
"5": "2688"
},
{
"0": "15.000",
"1": "9",
"2": "165",
"3": "102016",
"4": "12416.00",
"5": "896"
},
{
"0": "15.000",
"1": "9",
"2": "167",
"3": "16896",
"4": "4608.00",
"5": "256"
},
{
"0": "15.000",
"1": "9",
"2": "168",
"3": "141184",
"4": "21619.20",
"5": "1408"
},
{
"0": "15.000",
"1": "9",
"2": "170",
"3": "75776",
"4": "13760.00",
"5": "768"
},
{
"0": "15.000",
"1": "9",
"2": "171",
"3": "112512",
"4": "14681.60",
"5": "1024"
},
{
"0": "15.000",
"1": "9",
"2": "172",
"3": "77824",
"4": "10137.60",
"5": "768"
},
{
"0": "15.000",
"1": "9",
"2": "174",
"3": "7680",
"4": "2304.00",
"5": "128"
}
]
},
"text/html": "
| Tax Rate | Lineage Key | Salesperson Key | SUM_QTY | SUM_BASE_PRICE | COUNT_ORDER |
|---|
| 15.000 | 9 | 4 | 433280 | 243367.68 | 9216 |
| 15.000 | 9 | 6 | 836480 | 543988.48 | 18432 |
| 15.000 | 9 | 7 | 724480 | 846118.40 | 24576 |
| 15.000 | 9 | 8 | 862080 | 1028780.80 | 22144 |
| 15.000 | 9 | 9 | 1101056 | 924917.76 | 28928 |
| 15.000 | 9 | 11 | 2279296 | 3886913.28 | 62848 |
| 15.000 | 9 | 12 | 3262592 | 3852878.08 | 85888 |
| 15.000 | 9 | 15 | 5484800 | 6343098.88 | 144256 |
| 15.000 | 9 | 19 | 91831040 | 107590420.48 | 2310528 |
| 15.000 | 9 | 21 | 1240960 | 2060285.44 | 37632 |
| 15.000 | 9 | 23 | 1003520 | 1541052.16 | 29696 |
| 15.000 | 9 | 25 | 2986624 | 2914885.12 | 73344 |
| 15.000 | 9 | 26 | 497536 | 725172.48 | 12416 |
| 15.000 | 9 | 27 | 598016 | 798522.88 | 14592 |
| 15.000 | 9 | 28 | 1233152 | 1474490.88 | 31488 |
| 15.000 | 9 | 29 | 387968 | 304568.32 | 10880 |
| 15.000 | 9 | 30 | 1549312 | 2156144.64 | 47232 |
| 15.000 | 9 | 31 | 2215296 | 2227068.16 | 50560 |
| 15.000 | 9 | 35 | 2724736 | 3383616.00 | 72960 |
| 15.000 | 9 | 36 | 11016320 | 12551537.92 | 276992 |
| 15.000 | 9 | 38 | 1519744 | 1955315.20 | 39552 |
| 15.000 | 9 | 39 | 31888384 | 34617245.44 | 785664 |
| 15.000 | 9 | 40 | 6807424 | 7944593.92 | 176896 |
| 15.000 | 9 | 41 | 2219136 | 3174849.28 | 63232 |
| 15.000 | 9 | 45 | 338176 | 382839.04 | 7808 |
| 15.000 | 9 | 46 | 112128 | 111915.52 | 2176 |
| 15.000 | 9 | 47 | 3255680 | 2629954.56 | 75776 |
| 15.000 | 9 | 48 | 2595968 | 2310150.40 | 60928 |
| 15.000 | 9 | 49 | 14758528 | 17928881.92 | 368768 |
| 15.000 | 9 | 50 | 804352 | 926225.92 | 19968 |
| 15.000 | 9 | 51 | 4007808 | 4360591.36 | 97408 |
| 15.000 | 9 | 52 | 5863424 | 7464648.96 | 156160 |
| 15.000 | 9 | 54 | 2736768 | 3351491.84 | 72320 |
| 15.000 | 9 | 56 | 285824 | 253144.32 | 7552 |
| 15.000 | 9 | 57 | 2298240 | 2447610.88 | 58240 |
| 15.000 | 9 | 58 | 2144768 | 1723477.76 | 50048 |
| 15.000 | 9 | 61 | 3732224 | 4086886.40 | 86016 |
| 15.000 | 9 | 62 | 12672128 | 13904339.20 | 304000 |
| 15.000 | 9 | 63 | 10126208 | 10138237.44 | 243200 |
| 15.000 | 9 | 65 | 6787456 | 7473853.44 | 171136 |
| 15.000 | 9 | 68 | 4638720 | 4848647.68 | 107008 |
| 15.000 | 9 | 70 | 14884864 | 16764665.60 | 379776 |
| 15.000 | 9 | 72 | 2565888 | 2336160.00 | 55936 |
| 15.000 | 9 | 74 | 15317888 | 19187417.60 | 384768 |
| 15.000 | 9 | 76 | 6481280 | 8637446.40 | 169088 |
| 15.000 | 9 | 77 | 7128320 | 7693249.28 | 169984 |
| 15.000 | 9 | 78 | 5061376 | 5629213.44 | 121856 |
| 15.000 | 9 | 80 | 7743104 | 8722903.04 | 203264 |
| 15.000 | 9 | 81 | 28808064 | 32882525.44 | 706048 |
| 15.000 | 9 | 83 | 12662272 | 14586407.68 | 330880 |
| 15.000 | 9 | 84 | 6509184 | 8482062.08 | 169856 |
| 15.000 | 9 | 85 | 4782592 | 4991431.68 | 116864 |
| 15.000 | 9 | 86 | 27021696 | 30225996.80 | 682624 |
| 15.000 | 9 | 89 | 1578752 | 2027873.28 | 36096 |
| 15.000 | 9 | 90 | 33806464 | 39663014.40 | 856704 |
| 15.000 | 9 | 91 | 4442752 | 5842634.24 | 112768 |
| 15.000 | 9 | 93 | 28200192 | 33006179.84 | 713984 |
| 15.000 | 9 | 94 | 12681600 | 13601986.56 | 303232 |
| 15.000 | 9 | 96 | 666624 | 473141.76 | 14464 |
| 15.000 | 9 | 97 | 11993088 | 13300569.60 | 303104 |
| 15.000 | 9 | 101 | 7575168 | 7600646.40 | 196992 |
| 15.000 | 9 | 102 | 27441920 | 33995997.44 | 703872 |
| 15.000 | 9 | 103 | 7057280 | 8503637.76 | 185088 |
| 15.000 | 9 | 105 | 29710848 | 34073157.12 | 735872 |
| 15.000 | 9 | 106 | 8104704 | 9812775.68 | 220416 |
| 15.000 | 9 | 107 | 2590464 | 3028149.76 | 61952 |
| 15.000 | 9 | 108 | 40156160 | 45593496.32 | 1001600 |
| 15.000 | 9 | 115 | 2452096 | 2226137.60 | 60800 |
| 15.000 | 9 | 116 | 23243392 | 24868823.04 | 564736 |
| 15.000 | 9 | 118 | 14240128 | 15111184.64 | 353408 |
| 15.000 | 9 | 119 | 40846720 | 45264224.00 | 1027456 |
| 15.000 | 9 | 122 | 6732544 | 7716145.92 | 164992 |
| 15.000 | 9 | 126 | 7082880 | 8110862.08 | 171008 |
| 15.000 | 9 | 127 | 24211712 | 28525308.16 | 616576 |
| 15.000 | 9 | 129 | 31437312 | 34298964.48 | 767488 |
| 15.000 | 9 | 130 | 390272 | 315754.24 | 10880 |
| 15.000 | 9 | 134 | 19598208 | 22598796.80 | 491520 |
| 15.000 | 9 | 136 | 357248 | 296313.60 | 9856 |
| 15.000 | 9 | 138 | 4697088 | 5400261.12 | 118144 |
| 15.000 | 9 | 140 | 17321984 | 19747557.12 | 433280 |
| 15.000 | 9 | 143 | 22007296 | 26812788.48 | 567040 |
| 15.000 | 9 | 144 | 7777664 | 9402172.16 | 193152 |
| 15.000 | 9 | 145 | 15399680 | 17946855.68 | 388096 |
| 15.000 | 9 | 149 | 2256896 | 2663919.36 | 60416 |
| 15.000 | 9 | 150 | 10869632 | 12971114.24 | 281344 |
| 15.000 | 9 | 151 | 11137920 | 11154696.96 | 269568 |
| 15.000 | 9 | 152 | 11700480 | 13719448.32 | 285056 |
| 15.000 | 9 | 154 | 8281344 | 8556992.00 | 212864 |
| 15.000 | 9 | 155 | 8951424 | 9563397.12 | 219264 |
| 15.000 | 9 | 156 | 6004608 | 5900654.08 | 152192 |
| 15.000 | 9 | 158 | 500480 | 65113.60 | 4352 |
| 15.000 | 9 | 161 | 253952 | 56025.60 | 2816 |
| 15.000 | 9 | 163 | 248320 | 48179.20 | 2688 |
| 15.000 | 9 | 165 | 102016 | 12416.00 | 896 |
| 15.000 | 9 | 167 | 16896 | 4608.00 | 256 |
| 15.000 | 9 | 168 | 141184 | 21619.20 | 1408 |
| 15.000 | 9 | 170 | 75776 | 13760.00 | 768 |
| 15.000 | 9 | 171 | 112512 | 14681.60 | 1024 |
| 15.000 | 9 | 172 | 77824 | 10137.60 | 768 |
| 15.000 | 9 | 174 | 7680 | 2304.00 | 128 |
"
}
}
],
"execution_count": 8
},
{
"cell_type": "markdown",
"source": [
"**Step 4**: Let us run the same query from Step 3 but now with Batchmode for Rowstore. "
],
"metadata": {
"azdata_cell_guid": "6140b74a-e79d-4108-9cba-415f66ed85a3"
}
},
{
"cell_type": "code",
"source": [
"ALTER DATABASE [WideWorldImportersDW] SET COMPATIBILITY_LEVEL = 150;\r\n",
"GO\r\n",
"\r\n",
"ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE;\r\n",
"GO\r\n",
"\r\n",
"USE [WideWorldImportersDW]\r\n",
"GO\r\n",
"-- Batch mode on rowstore eligible\r\n",
"SELECT\t[Tax Rate],\r\n",
"\t\t[Lineage Key],\r\n",
"\t\t[Salesperson Key],\r\n",
"\tSUM([Quantity])\t\t\t\t\tAS SUM_QTY,\r\n",
"\tSUM([Unit Price])\t\t\t\tAS SUM_BASE_PRICE,\r\n",
"\tCOUNT(*)\t\t\t\t\tAS COUNT_ORDER\r\n",
"FROM\t[Fact].[OrderHistoryExtended]\r\n",
"WHERE\t[Order Date Key]\t<= dateadd(dd, -73, '2015-11-13')\r\n",
"GROUP\tBY\t[Tax Rate],\r\n",
"\t\t[Lineage Key],\r\n",
"\t\t[Salesperson Key]\r\n",
"ORDER\tBY\t[Tax Rate],\r\n",
"\t\t[Lineage Key],\r\n",
"\t\t[Salesperson Key]\r\n",
"OPTION (RECOMPILE);"
],
"metadata": {
"azdata_cell_guid": "d37ad2f6-5a09-4418-8ba2-47f954af18e8"
},
"outputs": [
{
"output_type": "display_data",
"data": {
"text/html": "Commands completed successfully."
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/html": "Commands completed successfully."
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/html": "Commands completed successfully."
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/html": "(100 rows affected)"
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/html": "Total execution time: 00:00:05.395"
},
"metadata": {}
},
{
"output_type": "execute_result",
"metadata": {},
"execution_count": 9,
"data": {
"application/vnd.dataresource+json": {
"schema": {
"fields": [
{
"name": "Tax Rate"
},
{
"name": "Lineage Key"
},
{
"name": "Salesperson Key"
},
{
"name": "SUM_QTY"
},
{
"name": "SUM_BASE_PRICE"
},
{
"name": "COUNT_ORDER"
}
]
},
"data": [
{
"0": "15.000",
"1": "9",
"2": "4",
"3": "433280",
"4": "243367.68",
"5": "9216"
},
{
"0": "15.000",
"1": "9",
"2": "6",
"3": "836480",
"4": "543988.48",
"5": "18432"
},
{
"0": "15.000",
"1": "9",
"2": "7",
"3": "724480",
"4": "846118.40",
"5": "24576"
},
{
"0": "15.000",
"1": "9",
"2": "8",
"3": "862080",
"4": "1028780.80",
"5": "22144"
},
{
"0": "15.000",
"1": "9",
"2": "9",
"3": "1101056",
"4": "924917.76",
"5": "28928"
},
{
"0": "15.000",
"1": "9",
"2": "11",
"3": "2279296",
"4": "3886913.28",
"5": "62848"
},
{
"0": "15.000",
"1": "9",
"2": "12",
"3": "3262592",
"4": "3852878.08",
"5": "85888"
},
{
"0": "15.000",
"1": "9",
"2": "15",
"3": "5484800",
"4": "6343098.88",
"5": "144256"
},
{
"0": "15.000",
"1": "9",
"2": "19",
"3": "91831040",
"4": "107590420.48",
"5": "2310528"
},
{
"0": "15.000",
"1": "9",
"2": "21",
"3": "1240960",
"4": "2060285.44",
"5": "37632"
},
{
"0": "15.000",
"1": "9",
"2": "23",
"3": "1003520",
"4": "1541052.16",
"5": "29696"
},
{
"0": "15.000",
"1": "9",
"2": "25",
"3": "2986624",
"4": "2914885.12",
"5": "73344"
},
{
"0": "15.000",
"1": "9",
"2": "26",
"3": "497536",
"4": "725172.48",
"5": "12416"
},
{
"0": "15.000",
"1": "9",
"2": "27",
"3": "598016",
"4": "798522.88",
"5": "14592"
},
{
"0": "15.000",
"1": "9",
"2": "28",
"3": "1233152",
"4": "1474490.88",
"5": "31488"
},
{
"0": "15.000",
"1": "9",
"2": "29",
"3": "387968",
"4": "304568.32",
"5": "10880"
},
{
"0": "15.000",
"1": "9",
"2": "30",
"3": "1549312",
"4": "2156144.64",
"5": "47232"
},
{
"0": "15.000",
"1": "9",
"2": "31",
"3": "2215296",
"4": "2227068.16",
"5": "50560"
},
{
"0": "15.000",
"1": "9",
"2": "35",
"3": "2724736",
"4": "3383616.00",
"5": "72960"
},
{
"0": "15.000",
"1": "9",
"2": "36",
"3": "11016320",
"4": "12551537.92",
"5": "276992"
},
{
"0": "15.000",
"1": "9",
"2": "38",
"3": "1519744",
"4": "1955315.20",
"5": "39552"
},
{
"0": "15.000",
"1": "9",
"2": "39",
"3": "31888384",
"4": "34617245.44",
"5": "785664"
},
{
"0": "15.000",
"1": "9",
"2": "40",
"3": "6807424",
"4": "7944593.92",
"5": "176896"
},
{
"0": "15.000",
"1": "9",
"2": "41",
"3": "2219136",
"4": "3174849.28",
"5": "63232"
},
{
"0": "15.000",
"1": "9",
"2": "45",
"3": "338176",
"4": "382839.04",
"5": "7808"
},
{
"0": "15.000",
"1": "9",
"2": "46",
"3": "112128",
"4": "111915.52",
"5": "2176"
},
{
"0": "15.000",
"1": "9",
"2": "47",
"3": "3255680",
"4": "2629954.56",
"5": "75776"
},
{
"0": "15.000",
"1": "9",
"2": "48",
"3": "2595968",
"4": "2310150.40",
"5": "60928"
},
{
"0": "15.000",
"1": "9",
"2": "49",
"3": "14758528",
"4": "17928881.92",
"5": "368768"
},
{
"0": "15.000",
"1": "9",
"2": "50",
"3": "804352",
"4": "926225.92",
"5": "19968"
},
{
"0": "15.000",
"1": "9",
"2": "51",
"3": "4007808",
"4": "4360591.36",
"5": "97408"
},
{
"0": "15.000",
"1": "9",
"2": "52",
"3": "5863424",
"4": "7464648.96",
"5": "156160"
},
{
"0": "15.000",
"1": "9",
"2": "54",
"3": "2736768",
"4": "3351491.84",
"5": "72320"
},
{
"0": "15.000",
"1": "9",
"2": "56",
"3": "285824",
"4": "253144.32",
"5": "7552"
},
{
"0": "15.000",
"1": "9",
"2": "57",
"3": "2298240",
"4": "2447610.88",
"5": "58240"
},
{
"0": "15.000",
"1": "9",
"2": "58",
"3": "2144768",
"4": "1723477.76",
"5": "50048"
},
{
"0": "15.000",
"1": "9",
"2": "61",
"3": "3732224",
"4": "4086886.40",
"5": "86016"
},
{
"0": "15.000",
"1": "9",
"2": "62",
"3": "12672128",
"4": "13904339.20",
"5": "304000"
},
{
"0": "15.000",
"1": "9",
"2": "63",
"3": "10126208",
"4": "10138237.44",
"5": "243200"
},
{
"0": "15.000",
"1": "9",
"2": "65",
"3": "6787456",
"4": "7473853.44",
"5": "171136"
},
{
"0": "15.000",
"1": "9",
"2": "68",
"3": "4638720",
"4": "4848647.68",
"5": "107008"
},
{
"0": "15.000",
"1": "9",
"2": "70",
"3": "14884864",
"4": "16764665.60",
"5": "379776"
},
{
"0": "15.000",
"1": "9",
"2": "72",
"3": "2565888",
"4": "2336160.00",
"5": "55936"
},
{
"0": "15.000",
"1": "9",
"2": "74",
"3": "15317888",
"4": "19187417.60",
"5": "384768"
},
{
"0": "15.000",
"1": "9",
"2": "76",
"3": "6481280",
"4": "8637446.40",
"5": "169088"
},
{
"0": "15.000",
"1": "9",
"2": "77",
"3": "7128320",
"4": "7693249.28",
"5": "169984"
},
{
"0": "15.000",
"1": "9",
"2": "78",
"3": "5061376",
"4": "5629213.44",
"5": "121856"
},
{
"0": "15.000",
"1": "9",
"2": "80",
"3": "7743104",
"4": "8722903.04",
"5": "203264"
},
{
"0": "15.000",
"1": "9",
"2": "81",
"3": "28808064",
"4": "32882525.44",
"5": "706048"
},
{
"0": "15.000",
"1": "9",
"2": "83",
"3": "12662272",
"4": "14586407.68",
"5": "330880"
},
{
"0": "15.000",
"1": "9",
"2": "84",
"3": "6509184",
"4": "8482062.08",
"5": "169856"
},
{
"0": "15.000",
"1": "9",
"2": "85",
"3": "4782592",
"4": "4991431.68",
"5": "116864"
},
{
"0": "15.000",
"1": "9",
"2": "86",
"3": "27021696",
"4": "30225996.80",
"5": "682624"
},
{
"0": "15.000",
"1": "9",
"2": "89",
"3": "1578752",
"4": "2027873.28",
"5": "36096"
},
{
"0": "15.000",
"1": "9",
"2": "90",
"3": "33806464",
"4": "39663014.40",
"5": "856704"
},
{
"0": "15.000",
"1": "9",
"2": "91",
"3": "4442752",
"4": "5842634.24",
"5": "112768"
},
{
"0": "15.000",
"1": "9",
"2": "93",
"3": "28200192",
"4": "33006179.84",
"5": "713984"
},
{
"0": "15.000",
"1": "9",
"2": "94",
"3": "12681600",
"4": "13601986.56",
"5": "303232"
},
{
"0": "15.000",
"1": "9",
"2": "96",
"3": "666624",
"4": "473141.76",
"5": "14464"
},
{
"0": "15.000",
"1": "9",
"2": "97",
"3": "11993088",
"4": "13300569.60",
"5": "303104"
},
{
"0": "15.000",
"1": "9",
"2": "101",
"3": "7575168",
"4": "7600646.40",
"5": "196992"
},
{
"0": "15.000",
"1": "9",
"2": "102",
"3": "27441920",
"4": "33995997.44",
"5": "703872"
},
{
"0": "15.000",
"1": "9",
"2": "103",
"3": "7057280",
"4": "8503637.76",
"5": "185088"
},
{
"0": "15.000",
"1": "9",
"2": "105",
"3": "29710848",
"4": "34073157.12",
"5": "735872"
},
{
"0": "15.000",
"1": "9",
"2": "106",
"3": "8104704",
"4": "9812775.68",
"5": "220416"
},
{
"0": "15.000",
"1": "9",
"2": "107",
"3": "2590464",
"4": "3028149.76",
"5": "61952"
},
{
"0": "15.000",
"1": "9",
"2": "108",
"3": "40156160",
"4": "45593496.32",
"5": "1001600"
},
{
"0": "15.000",
"1": "9",
"2": "115",
"3": "2452096",
"4": "2226137.60",
"5": "60800"
},
{
"0": "15.000",
"1": "9",
"2": "116",
"3": "23243392",
"4": "24868823.04",
"5": "564736"
},
{
"0": "15.000",
"1": "9",
"2": "118",
"3": "14240128",
"4": "15111184.64",
"5": "353408"
},
{
"0": "15.000",
"1": "9",
"2": "119",
"3": "40846720",
"4": "45264224.00",
"5": "1027456"
},
{
"0": "15.000",
"1": "9",
"2": "122",
"3": "6732544",
"4": "7716145.92",
"5": "164992"
},
{
"0": "15.000",
"1": "9",
"2": "126",
"3": "7082880",
"4": "8110862.08",
"5": "171008"
},
{
"0": "15.000",
"1": "9",
"2": "127",
"3": "24211712",
"4": "28525308.16",
"5": "616576"
},
{
"0": "15.000",
"1": "9",
"2": "129",
"3": "31437312",
"4": "34298964.48",
"5": "767488"
},
{
"0": "15.000",
"1": "9",
"2": "130",
"3": "390272",
"4": "315754.24",
"5": "10880"
},
{
"0": "15.000",
"1": "9",
"2": "134",
"3": "19598208",
"4": "22598796.80",
"5": "491520"
},
{
"0": "15.000",
"1": "9",
"2": "136",
"3": "357248",
"4": "296313.60",
"5": "9856"
},
{
"0": "15.000",
"1": "9",
"2": "138",
"3": "4697088",
"4": "5400261.12",
"5": "118144"
},
{
"0": "15.000",
"1": "9",
"2": "140",
"3": "17321984",
"4": "19747557.12",
"5": "433280"
},
{
"0": "15.000",
"1": "9",
"2": "143",
"3": "22007296",
"4": "26812788.48",
"5": "567040"
},
{
"0": "15.000",
"1": "9",
"2": "144",
"3": "7777664",
"4": "9402172.16",
"5": "193152"
},
{
"0": "15.000",
"1": "9",
"2": "145",
"3": "15399680",
"4": "17946855.68",
"5": "388096"
},
{
"0": "15.000",
"1": "9",
"2": "149",
"3": "2256896",
"4": "2663919.36",
"5": "60416"
},
{
"0": "15.000",
"1": "9",
"2": "150",
"3": "10869632",
"4": "12971114.24",
"5": "281344"
},
{
"0": "15.000",
"1": "9",
"2": "151",
"3": "11137920",
"4": "11154696.96",
"5": "269568"
},
{
"0": "15.000",
"1": "9",
"2": "152",
"3": "11700480",
"4": "13719448.32",
"5": "285056"
},
{
"0": "15.000",
"1": "9",
"2": "154",
"3": "8281344",
"4": "8556992.00",
"5": "212864"
},
{
"0": "15.000",
"1": "9",
"2": "155",
"3": "8951424",
"4": "9563397.12",
"5": "219264"
},
{
"0": "15.000",
"1": "9",
"2": "156",
"3": "6004608",
"4": "5900654.08",
"5": "152192"
},
{
"0": "15.000",
"1": "9",
"2": "158",
"3": "500480",
"4": "65113.60",
"5": "4352"
},
{
"0": "15.000",
"1": "9",
"2": "161",
"3": "253952",
"4": "56025.60",
"5": "2816"
},
{
"0": "15.000",
"1": "9",
"2": "163",
"3": "248320",
"4": "48179.20",
"5": "2688"
},
{
"0": "15.000",
"1": "9",
"2": "165",
"3": "102016",
"4": "12416.00",
"5": "896"
},
{
"0": "15.000",
"1": "9",
"2": "167",
"3": "16896",
"4": "4608.00",
"5": "256"
},
{
"0": "15.000",
"1": "9",
"2": "168",
"3": "141184",
"4": "21619.20",
"5": "1408"
},
{
"0": "15.000",
"1": "9",
"2": "170",
"3": "75776",
"4": "13760.00",
"5": "768"
},
{
"0": "15.000",
"1": "9",
"2": "171",
"3": "112512",
"4": "14681.60",
"5": "1024"
},
{
"0": "15.000",
"1": "9",
"2": "172",
"3": "77824",
"4": "10137.60",
"5": "768"
},
{
"0": "15.000",
"1": "9",
"2": "174",
"3": "7680",
"4": "2304.00",
"5": "128"
}
]
},
"text/html": "| Tax Rate | Lineage Key | Salesperson Key | SUM_QTY | SUM_BASE_PRICE | COUNT_ORDER |
|---|
| 15.000 | 9 | 4 | 433280 | 243367.68 | 9216 |
| 15.000 | 9 | 6 | 836480 | 543988.48 | 18432 |
| 15.000 | 9 | 7 | 724480 | 846118.40 | 24576 |
| 15.000 | 9 | 8 | 862080 | 1028780.80 | 22144 |
| 15.000 | 9 | 9 | 1101056 | 924917.76 | 28928 |
| 15.000 | 9 | 11 | 2279296 | 3886913.28 | 62848 |
| 15.000 | 9 | 12 | 3262592 | 3852878.08 | 85888 |
| 15.000 | 9 | 15 | 5484800 | 6343098.88 | 144256 |
| 15.000 | 9 | 19 | 91831040 | 107590420.48 | 2310528 |
| 15.000 | 9 | 21 | 1240960 | 2060285.44 | 37632 |
| 15.000 | 9 | 23 | 1003520 | 1541052.16 | 29696 |
| 15.000 | 9 | 25 | 2986624 | 2914885.12 | 73344 |
| 15.000 | 9 | 26 | 497536 | 725172.48 | 12416 |
| 15.000 | 9 | 27 | 598016 | 798522.88 | 14592 |
| 15.000 | 9 | 28 | 1233152 | 1474490.88 | 31488 |
| 15.000 | 9 | 29 | 387968 | 304568.32 | 10880 |
| 15.000 | 9 | 30 | 1549312 | 2156144.64 | 47232 |
| 15.000 | 9 | 31 | 2215296 | 2227068.16 | 50560 |
| 15.000 | 9 | 35 | 2724736 | 3383616.00 | 72960 |
| 15.000 | 9 | 36 | 11016320 | 12551537.92 | 276992 |
| 15.000 | 9 | 38 | 1519744 | 1955315.20 | 39552 |
| 15.000 | 9 | 39 | 31888384 | 34617245.44 | 785664 |
| 15.000 | 9 | 40 | 6807424 | 7944593.92 | 176896 |
| 15.000 | 9 | 41 | 2219136 | 3174849.28 | 63232 |
| 15.000 | 9 | 45 | 338176 | 382839.04 | 7808 |
| 15.000 | 9 | 46 | 112128 | 111915.52 | 2176 |
| 15.000 | 9 | 47 | 3255680 | 2629954.56 | 75776 |
| 15.000 | 9 | 48 | 2595968 | 2310150.40 | 60928 |
| 15.000 | 9 | 49 | 14758528 | 17928881.92 | 368768 |
| 15.000 | 9 | 50 | 804352 | 926225.92 | 19968 |
| 15.000 | 9 | 51 | 4007808 | 4360591.36 | 97408 |
| 15.000 | 9 | 52 | 5863424 | 7464648.96 | 156160 |
| 15.000 | 9 | 54 | 2736768 | 3351491.84 | 72320 |
| 15.000 | 9 | 56 | 285824 | 253144.32 | 7552 |
| 15.000 | 9 | 57 | 2298240 | 2447610.88 | 58240 |
| 15.000 | 9 | 58 | 2144768 | 1723477.76 | 50048 |
| 15.000 | 9 | 61 | 3732224 | 4086886.40 | 86016 |
| 15.000 | 9 | 62 | 12672128 | 13904339.20 | 304000 |
| 15.000 | 9 | 63 | 10126208 | 10138237.44 | 243200 |
| 15.000 | 9 | 65 | 6787456 | 7473853.44 | 171136 |
| 15.000 | 9 | 68 | 4638720 | 4848647.68 | 107008 |
| 15.000 | 9 | 70 | 14884864 | 16764665.60 | 379776 |
| 15.000 | 9 | 72 | 2565888 | 2336160.00 | 55936 |
| 15.000 | 9 | 74 | 15317888 | 19187417.60 | 384768 |
| 15.000 | 9 | 76 | 6481280 | 8637446.40 | 169088 |
| 15.000 | 9 | 77 | 7128320 | 7693249.28 | 169984 |
| 15.000 | 9 | 78 | 5061376 | 5629213.44 | 121856 |
| 15.000 | 9 | 80 | 7743104 | 8722903.04 | 203264 |
| 15.000 | 9 | 81 | 28808064 | 32882525.44 | 706048 |
| 15.000 | 9 | 83 | 12662272 | 14586407.68 | 330880 |
| 15.000 | 9 | 84 | 6509184 | 8482062.08 | 169856 |
| 15.000 | 9 | 85 | 4782592 | 4991431.68 | 116864 |
| 15.000 | 9 | 86 | 27021696 | 30225996.80 | 682624 |
| 15.000 | 9 | 89 | 1578752 | 2027873.28 | 36096 |
| 15.000 | 9 | 90 | 33806464 | 39663014.40 | 856704 |
| 15.000 | 9 | 91 | 4442752 | 5842634.24 | 112768 |
| 15.000 | 9 | 93 | 28200192 | 33006179.84 | 713984 |
| 15.000 | 9 | 94 | 12681600 | 13601986.56 | 303232 |
| 15.000 | 9 | 96 | 666624 | 473141.76 | 14464 |
| 15.000 | 9 | 97 | 11993088 | 13300569.60 | 303104 |
| 15.000 | 9 | 101 | 7575168 | 7600646.40 | 196992 |
| 15.000 | 9 | 102 | 27441920 | 33995997.44 | 703872 |
| 15.000 | 9 | 103 | 7057280 | 8503637.76 | 185088 |
| 15.000 | 9 | 105 | 29710848 | 34073157.12 | 735872 |
| 15.000 | 9 | 106 | 8104704 | 9812775.68 | 220416 |
| 15.000 | 9 | 107 | 2590464 | 3028149.76 | 61952 |
| 15.000 | 9 | 108 | 40156160 | 45593496.32 | 1001600 |
| 15.000 | 9 | 115 | 2452096 | 2226137.60 | 60800 |
| 15.000 | 9 | 116 | 23243392 | 24868823.04 | 564736 |
| 15.000 | 9 | 118 | 14240128 | 15111184.64 | 353408 |
| 15.000 | 9 | 119 | 40846720 | 45264224.00 | 1027456 |
| 15.000 | 9 | 122 | 6732544 | 7716145.92 | 164992 |
| 15.000 | 9 | 126 | 7082880 | 8110862.08 | 171008 |
| 15.000 | 9 | 127 | 24211712 | 28525308.16 | 616576 |
| 15.000 | 9 | 129 | 31437312 | 34298964.48 | 767488 |
| 15.000 | 9 | 130 | 390272 | 315754.24 | 10880 |
| 15.000 | 9 | 134 | 19598208 | 22598796.80 | 491520 |
| 15.000 | 9 | 136 | 357248 | 296313.60 | 9856 |
| 15.000 | 9 | 138 | 4697088 | 5400261.12 | 118144 |
| 15.000 | 9 | 140 | 17321984 | 19747557.12 | 433280 |
| 15.000 | 9 | 143 | 22007296 | 26812788.48 | 567040 |
| 15.000 | 9 | 144 | 7777664 | 9402172.16 | 193152 |
| 15.000 | 9 | 145 | 15399680 | 17946855.68 | 388096 |
| 15.000 | 9 | 149 | 2256896 | 2663919.36 | 60416 |
| 15.000 | 9 | 150 | 10869632 | 12971114.24 | 281344 |
| 15.000 | 9 | 151 | 11137920 | 11154696.96 | 269568 |
| 15.000 | 9 | 152 | 11700480 | 13719448.32 | 285056 |
| 15.000 | 9 | 154 | 8281344 | 8556992.00 | 212864 |
| 15.000 | 9 | 155 | 8951424 | 9563397.12 | 219264 |
| 15.000 | 9 | 156 | 6004608 | 5900654.08 | 152192 |
| 15.000 | 9 | 158 | 500480 | 65113.60 | 4352 |
| 15.000 | 9 | 161 | 253952 | 56025.60 | 2816 |
| 15.000 | 9 | 163 | 248320 | 48179.20 | 2688 |
| 15.000 | 9 | 165 | 102016 | 12416.00 | 896 |
| 15.000 | 9 | 167 | 16896 | 4608.00 | 256 |
| 15.000 | 9 | 168 | 141184 | 21619.20 | 1408 |
| 15.000 | 9 | 170 | 75776 | 13760.00 | 768 |
| 15.000 | 9 | 171 | 112512 | 14681.60 | 1024 |
| 15.000 | 9 | 172 | 77824 | 10137.60 | 768 |
| 15.000 | 9 | 174 | 7680 | 2304.00 | 128 |
"
}
}
],
"execution_count": 9
},
{
"cell_type": "markdown",
"source": [
"### As you can see from the execution times, the query with Batch Mode for Rowstore finished much faster!"
],
"metadata": {
"azdata_cell_guid": "0992ad26-d475-47ef-9b3e-5b9ccd429013"
}
}
]
}