SQL SERVER分区表探寻(二)

接上篇文章的疑问。

新建一个多达120个分区的新表:pt_PatitionTable120。最终各表情况如下:

pt_PatitionTable24:60W条

pt_PatitionTable60:288W条

pt_PatitionTable120:778W条


在SQL Batch中同时执行如下语句:

select * from pt_PatitionTable24 where enterDate >= '2013-05-01' and enterDate < '2013-06-01'
select * from pt_PatitionTable60 where enterdate >= '2013-05-01' and enterdate < '2013-06-01'
select * from pt_PatitionTable120 where enterDate >= '2013-05-01' and enterDate < '2013-06-01'

查询分析结果如下:


分析“Query Cost”百分比,各个表之间的差异均不是很大。由此是否可以证明,分区的多少,并不会影响到性能呢?


再调用命令“SET STATISTICS IO ON”、“SET STATISTICS TIME ON”结果如下:

(59411 row(s) affected)
Table 'pt_PatitionTable24'. Scan count 1, logical reads 2901, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.


 SQL Server Execution Times:
   CPU time = 358 ms,  elapsed time = 6409 ms.
SQL Server parse and compile time: 
   CPU time = 0 ms, elapsed time = 0 ms.


(59411 row(s) affected)
Table 'pt_PatitionTable60'. Scan count 1, logical reads 2776, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.


 SQL Server Execution Times:
   CPU time = 375 ms,  elapsed time = 7201 ms.
SQL Server parse and compile time: 
   CPU time = 0 ms, elapsed time = 0 ms.


(59411 row(s) affected)
Table 'pt_PatitionTable120'. Scan count 1, logical reads 2775, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.


 SQL Server Execution Times:
   CPU time = 437 ms,  elapsed time = 6548 ms.

无论是CPU执行时间,还是“Logical Reads”指标都差异不大。这是否更加预示着分区的多少不会影响到效率呢?


当然,我们有一个前提就是,我们服务器没有做RAID。




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值