rus*_*ind 6 sql-server parallelism partitioning sql-server-2016 enterprise-edition
我正在查看SQL Server 标准版和企业版之间的差异,但无法重现此演示中宣传的差异,以解释这些差异- 我在跨标准版和企业版运行查询时观察到的性能具有可比性,并且查询并行运行执行计划中的分区表。
我已经证实:
set statistics time on似乎在 SQL Server 2016 中,这种差异是不可重现的。此功能是否还有其他影响 - 也许我没有测试正确的东西,但查询与演示中的查询相当。
这是我用来测试的脚本:
-- MAXDOP is 10
-- structure of table
--Column type
--testData.PKcolumn1 bigint
--testData.PKcolumn2 int
--date datetime
--testData.PKcolumn3 bigint
--metric1 float
--metric2 float
--metric3 float
--metric4 float
--index_description index_keys
--clustered, unique, primary key located on ps_testData categoryId, transactionId, date
--pf_testData/ps_testData is a range right datetime partition scheme, fanout 368
GO
-- Actual partition count: 368
-- all 10 threads participate in the scan, 12MM to 13MM rows / thread
-- each partition likely read by a single thread
SELECT COUNT(*), MIN(date), MAX(date)
FROM testData
GO
-- Actual partitions with data count: 31
-- all 10 threads participate in the scan, 3MM to 4MM rows / thread
-- each partition likely read by a single thread
SELECT COUNT(*), MIN(date), MAX(date)
FROM testData
WHERE date >= '2020-01-01' AND date < '2020-02-01'
GO
-- Actual partitions with data count: 7
-- all 10 threads participate in the scan, with a range of 0.5MM to 1MM rows per thread
-- some partitions were read by multiple threads
SELECT COUNT(*), MIN(date), MAX(date)
FROM testData
WHERE date >= '2020-01-01' AND date < '2020-01-08'
GO
-- Actual partitions with data count: 1
-- all 10 threads participate in the scan, 60K to 100K rows / thread (all threads read from a single partition)
SELECT COUNT(*), MIN(date), MAX(date)
FROM testData
WHERE date >= '2020-01-01' AND date < '2020-01-02'
GO
Run Code Online (Sandbox Code Playgroud)
nb 此查询有一个 group by 子句 - 两者都显示跨分区和同一分区内的并行性。
| 归档时间: |
|
| 查看次数: |
855 次 |
| 最近记录: |