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 suite of features.
This example will show you how upgrading to Database Compatibility Level 150 could improve performance due to batch mode on rowstore, when your workload has the following characteristics:
More information about this feature is available here.
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 WideWorldImportersDW database backup
You will need the WideWorldImportersDW database for this exercise. If you don't have this sample database, then you download the sample database here.
Restore the copied WideWorldImportersDW database backup into the container and restore the backup.
docker pull mcr.microsoft.com/mssql/server:2019-latest
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=`<A Strong Password`>" -p 1445:1433 --name sql2019demo -d mcr.microsoft.com/mssql/server:2019-latest
docker cp ".\Downloads\WideWorldImportersDW-Full.bak" sql2019demo:/var/opt/mssql/data
Note: For Linux installations the default path to use is /var/opt/mssql
USE [master]
GO
IF EXISTS (SELECT [database_id] FROM sys.databases WHERE [name] = 'WideWorldImportersDW')
ALTER DATABASE [WideWorldImportersDW] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
DECLARE @datafilepath VARCHAR(8000) = CAST(SERVERPROPERTY('InstanceDefaultDataPath') AS VARCHAR(4000)) + 'WideWorldImportersDW.mdf'
DECLARE @logfilepath VARCHAR(8000) = CAST(SERVERPROPERTY('InstanceDefaultLogPath') AS VARCHAR(4000)) + 'WideWorldImportersDW.ldf'
DECLARE @inmemfilepath VARCHAR(8000) = CAST(SERVERPROPERTY('InstanceDefaultDataPath') AS VARCHAR(4000)) + 'WideWorldImportersDW_InMemory_Data_1'
DECLARE @secondaryfilepath VARCHAR(8000) = CAST(SERVERPROPERTY('InstanceDefaultDataPath') AS VARCHAR(4000))+ 'WideWorldImportersDW_2.ndf'
-- Change @backupfile file path as needed
DECLARE @backupfile VARCHAR(8000) = 'E:\SampleDBs\WideWorldImportersDW-Full.bak'
RESTORE DATABASE WideWorldImportersDW
FROM DISK = @backupfile
WITH MOVE 'WWI_Primary' TO @datafilepath,
MOVE 'WWI_UserData' TO @secondaryfilepath,
MOVE 'WWIDW_InMemory_Data_1' TO @inmemfilepath,
MOVE 'WWI_Log' TO @logfilepath, NOUNLOAD, REPLACE, STATS = 10
GO
USE [master]
GO
ALTER DATABASE [WideWorldImportersDW] MODIFY FILE ( NAME = N'WWI_Log', SIZE = 4GB )
GO
USE WideWorldImportersDW;
GO
/*
Assumes a fresh restore of WideWorldImportersDW
*/
IF OBJECT_ID('Fact.OrderHistory') IS NULL
BEGIN
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]
INTO Fact.OrderHistory
FROM Fact.[Order];
END;
ALTER TABLE Fact.OrderHistory
ADD CONSTRAINT PK_Fact_OrderHistory PRIMARY KEY NONCLUSTERED ([Order Key] ASC, [Order Date Key] ASC) WITH (DATA_COMPRESSION = PAGE);
GO
CREATE INDEX IX_Stock_Item_Key
ON Fact.OrderHistory ([Stock Item Key])
INCLUDE(Quantity)
WITH (DATA_COMPRESSION = PAGE);
GO
CREATE INDEX IX_OrderHistory_Quantity
ON Fact.OrderHistory ([Quantity])
INCLUDE([Order Key])
WITH (DATA_COMPRESSION = PAGE);
GO
CREATE INDEX IX_OrderHistory_CustomerKey
ON Fact.OrderHistory([Customer Key])
INCLUDE ([Total Including Tax])
WITH (DATA_COMPRESSION = PAGE);
GO
IF (SELECT COUNT(*) FROM [Fact].[OrderHistory]) < 3702592
BEGIN
DECLARE @i smallint
SET @i = 0
WHILE @i < 4
BEGIN
INSERT INTO [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])
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]
FROM [Fact].[OrderHistory];
SET @i = @i +1
END;
END
GO
IF OBJECT_ID('Fact.OrderHistoryExtended') IS NULL
BEGIN
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]
INTO Fact.OrderHistoryExtended
FROM Fact.[OrderHistory];
END;
ALTER TABLE Fact.OrderHistoryExtended
ADD CONSTRAINT PK_Fact_OrderHistoryExtended PRIMARY KEY NONCLUSTERED ([Order Key] ASC, [Order Date Key] ASC)
WITH (DATA_COMPRESSION = PAGE);
GO
CREATE INDEX IX_Stock_Item_Key
ON Fact.OrderHistoryExtended ([Stock Item Key])
INCLUDE (Quantity);
GO
IF (SELECT COUNT(*) FROM [Fact].[OrderHistory]) < 29620736
BEGIN
DECLARE @i smallint
SET @i = 0
WHILE @i < 3
BEGIN
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])
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]
FROM Fact.OrderHistoryExtended;
SET @i = @i +1
END;
END
GO
UPDATE Fact.OrderHistoryExtended
SET [WWI Order ID] = [Order Key];
GO
-- Repeat the following until log shrinks. These demos don't require much log space.
CHECKPOINT
GO
DBCC SHRINKFILE (N'WWI_Log' , 0, TRUNCATEONLY)
GO
SELECT * FROM sys.dm_db_log_space_usage
GO
Even when the database compatibility level is set to the defauult (150), this can be done by using the USE HINT DISALLOW_BATCH_MODE query hint to disable the feature.
USE [WideWorldImportersDW];
GO
ALTER DATABASE [WideWorldImportersDW] SET COMPATIBILITY_LEVEL = 150;
GO
ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE;
GO
-- Row mode due to hint
SELECT [Tax Rate],
[Lineage Key],
[Salesperson Key],
SUM([Quantity]) AS SUM_QTY,
SUM([Unit Price]) AS SUM_BASE_PRICE,
COUNT(*) AS COUNT_ORDER
FROM [Fact].[OrderHistoryExtended]
WHERE [Order Date Key] <= dateadd(dd, -73, '2015-11-13')
GROUP BY [Tax Rate],
[Lineage Key],
[Salesperson Key]
ORDER BY [Tax Rate],
[Lineage Key],
[Salesperson Key]
OPTION (RECOMPILE, USE HINT('DISALLOW_BATCH_MODE'));
GO
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 |
Observe the query execution plan (or actual plan).
Notice the time spent in each operator (cumulative up the tree for a query in row mode). Also note the two Aggregate operators. The Hash Match only does a partial aggregate, so later in the execxution a Stream Aggregate is needed to fully aggregate the result set as intended. Stream Aggregates are only possible in Row Mode.
Confirm the Actual Execution Mode was indeed "Row", for example in the properties of the Table Scan operator.
Run the same query from Step 3, but now without any hint, allowing SQL Server to operate as default. If a query is eligible for Batch Mode on Rowstore, it will be used instead of Row Mode.
ALTER DATABASE [WideWorldImportersDW] SET COMPATIBILITY_LEVEL = 150;
GO
ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE;
GO
USE [WideWorldImportersDW]
GO
-- Batch mode on rowstore eligible
SELECT [Tax Rate],
[Lineage Key],
[Salesperson Key],
SUM([Quantity]) AS SUM_QTY,
SUM([Unit Price]) AS SUM_BASE_PRICE,
COUNT(*) AS COUNT_ORDER
FROM [Fact].[OrderHistoryExtended]
WHERE [Order Date Key] <= dateadd(dd, -73, '2015-11-13')
GROUP BY [Tax Rate],
[Lineage Key],
[Salesperson Key]
ORDER BY [Tax Rate],
[Lineage Key],
[Salesperson Key]
OPTION (RECOMPILE);
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 |
Observe the query execution plan (or actual plan).
Notice the time spent in each operator (not cumulative up the tree for a query in batch mode). Note the Stream Aggregate operator is not present. Also note that only one aggregate was required for the Batch Mode plan, which also improves the query execution.
Confirm the Actual Execution Mode was indeed "Batch", for example in the properties of the Table Scan operator.
As you can see from the execution times, the query with Batch Mode for Rowstore finished much faster! From ~5s to ~1.8s.