大考验:测试SQL Server各个版本的性能

http://www.sina.com.cn 2006年09月22日 18:31  ChinaByte

  今天闲得无聊,做了一个SQL Server的各个版本的性能测试, 大家都知道SQL Server有六个版本(企业版,标准版,个人版,开发版,Desktop Engine,SQL Server CE,企业评估版) . 我经常头晕那个适合我开发使用 ,今天终于决定好好的拷问一下微软! 测试SQL主要考察数据库服务器的写操作,读操作,索引操作,各位如果有兴趣,顺便在你们的机器上跑跑这个脚本,把结果贴出来?

  我机器的配置(公司用机)

  -- 赛扬4 1.7

  -- 256M内存

  -- 华硕845D主板

  -- NVida GeForce2 MX/MX 400 32M显存

  -- Maxtor 6E040L0 40G,7200转

  -- 英文Windows 2000 Professional with SP4

  -- 测试用的SQL (注意SQL里面的一个@iMax的变量)

  -----------------------------------------------

  f exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AreaBak]')

  and OBJECTPROPERTY(id, N'IsUserTable') = 1)

  truncate table [dbo].[AreaBak]

  go

  --drop table [dbo].[AreaBak]

  if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AreaBak]')

  and OBJECTPROPERTY(id, N'IsUserTable') = 1)

  begin

  CREATE TABLE [dbo].[AreaBak] (

  [AreaCode] bigint not null,

  [AreaName] [varchar] (16) COLLATE Chinese_PRC_CI_AS NOT NULL ,

  [LocaName] [varchar] (32) COLLATE Chinese_PRC_CI_AS NOT NULL

  ) ON [PRIMARY]

  ALTER TABLE [dbo].[AreaBak] WITH NOCHECK ADD

  CONSTRAINT [PK_AreaBak] PRIMARY KEY CLUSTERED

  (

  [AreaCode]

  ) ON [PRIMARY]

  end

  go

  declare @iMax bigint

  --<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

  set @iMax =1000 --<< 修改这个 iMax(1000,10000,20000,100000) 来对比测试结果 <<<<

  --<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

  declare @i bigint

  declare @tbegin datetime

  declare @tend datetime

  declare @fcout float

  set @tbegin = getdate()

  -- 测试写性能

  set @i =1

  WHILE @i<=@iMax

  BEGIN

  insert into AreaBak values(@i,

  rtrim(cast(@i as char(12)))+'XX',

  rtrim(cast(@i as char(12)))+'XXXX')

  set @i=@i+1

  END

  -- 测试索引性能

  set @i = @iMax

  WHILE @i >= (@iMax -50)

  BEGIN

  select * from AreaBak where AreaCode = @i

  set @i=@i-1

  END

  -- 测试大量数据读取性能

  select * from AreaBak

  set @tend = getdate()

  set @fcout = convert(float,(@tend -@tbegin)) --24*60*60换算秒

  set @fcout =@fcout*24.0*60.0*60.0

  print @fcout

  -----------------------------------------------

  -- 中文MSDE(without SP) 测试结果(秒)

  -----------------------------------------------

  -- iMax = 1000 : 0.873333 | 0.88 | 0.87

  -- iMax = 10000 : 8.45333 | 8.75333 | 8.32

  -- iMax = 100000 : 90.9533 | 82.4467 | 83.59

  -----------------------------------------------

  -- 英文MSDE(with SP3) 测试结果(秒)

  -----------------------------------------------

  -- iMax = 1000 : 0.93|0.913333| 0.93

  -- iMax = 10000 : 8.5|8.74333 |8.38333

  -- iMax = 20000 : 17.0733 |16.4633|17.8067

  -- iMax = 100000 : 82.9 | 82.2167 | 86.3533

  -----------------------------------------------

  -----------------------------------------------

  -- 英文个人版(without SP) 测试结果(秒)

  -----------------------------------------------

  -- iMax = 1000 : 0.863333|0.87 |0.87

  -- iMax = 10000 : 8.34333 | 8.25 |8.30333

  -- iMax = 20000 : 16.4633 | 16.5933 |16.6633

  -- iMax = 100000 : 81.27 | 86.9367 | 81.4567

  -----------------------------------------------

  -- 英文个人版(with SP3) 测试结果(秒)

  -----------------------------------------------

  -- iMax = 1000 : 0.913333 | 0.92 | 0.93 | 0.923333 | 0.913333

  -- iMax = 10000 : 8.46| 8.39333 |8.87333 | 8.25333 | 8.29 |

  -- iMax = 20000 : 16.9767 | 16.1933 | 16.3433 |16.2433 | 16.2867

  -- iMax = 100000 : 80.4867 | 81.8767 |80.9167 | 82.09 | 81.91

  -- iMax = 1000 : 0.673333/0.79/0.65(Memory被调整限制为102~255M)

  -- iMax = 10000 : 8.29333/8.21/8.16333(Memory被调整限制为102~255M)

  -- iMax = 100000 : 80.2267/ 80.1033 (Memory被调整限制为102~255M)

  -- iMax = 100000 : 79.0433/82.24(Memory被调整限制为0~5M)

  -----------------------------------------

  -- 英文开发版(without SP) 测试结果(秒)

  -----------------------------------------------

  -- iMax = 1000 : 0.863333| 0.86 | 0.85

  -- iMax = 10000 : 8.14 |8.60333 | 8.26333

  -- iMax = 20000 : 17.1433 | 17.0567 | 16.3333

  -- iMax = 100000 : 86.3833 | 85.7833 |86.5333

  -----------------------------------------------

  -- 英文开发版(with SP3) 测试结果(秒)

  -----------------------------------------------

  -- iMax = 1000 : 0.92|0.92| 0.923333

  -- iMax = 10000 : 8.17333| 8.39333| 8.28

  -- iMax = 20000 : 16.2733| 17.3033| 16.2333

  -- iMax = 100000 : 86.9967 | 85.8333 | 85.2233

  -----------------------------------------------

  因为操作系统的原因没有测试标准版和企业版的SQL Server , 如果你只是自己开发SQL Server的应用 在自己机器上大可不必安装企业版 开发版(如果你不是必须用到那些特殊的功能的话) . 事实上以上的测试结果表明 : 个人版with sp3 的单机(符合我们的开发环境)综合性能是最好.

  这个测试没有进行并发连接处理性能的考察 , 据微软官方称 :当并发执行 5 个以上的批处理时,SQL Server 2000 个人版和 SQL Server 2000 Desktop Engine 中的并发工作负荷调控器将限制性能。

  当使用 SQL Server 2000 Desktop Engine 或 Microsoft 数据引擎 (MSDE) 1.0 时,数据库的大小不能超过 2GB。(我个人经常有数据库大于2GB,而且Desktop Engine的安装不方便,还要加多一个图形化管理工具的安装.

  标准版和企业版都需要Windows2000 Server版以上才可以安装.

  微软的Memory(RAM)建议:

  Enterprise Edition 64 MB of minimum, 128 MB recommended

  Standard Edition 64 MB of minimum

  Personal Edition 64 MB on Windows 2000, 32 MB on all other operating systems (对内存的消耗是比较小的)

  Developer Edition 64 MB of minimum

  Desktop Engine 64 MB minimum on Windows 2000, 32 MB on all other operating systems

  最终结论 : 我自己在开发中决定使用 SQL Server 个人版 +SP3 ,发布的话就需要考虑客户的规模和财力了。

Powered By Google
不支持Flash
·城市对话改革30年 ·新浪城市同心联动 ·诚招合作伙伴 ·企业邮箱畅通无阻
不支持Flash