SQL Server 2005與Oracle 10g的"龜兔賽跑"
Oracle數(shù)據(jù)庫的應(yīng)用環(huán)境,一般來說比SQL Server要復(fù)雜,這也是大家形容Oracle與SQL Server是單反相機(jī)與傻瓜相機(jī)的區(qū)別。不過,傻瓜相機(jī)也有其好處,下面是作者的實(shí)際對(duì)比。
初學(xué)Oracle感覺它功能很強(qiáng)大,但總感覺Oracle查詢數(shù)據(jù),添加數(shù)據(jù)都比SQL Server慢。
一下是測(cè)試環(huán)境:
操作系統(tǒng) |
Microsoft Windows XP Professional |
CPU 類型 |
Intel(R) Celeron(R) CPU E3200 @ 2.40GHz DualCore , 2433 MHz (12 x 203) |
內(nèi)存: |
DDR3 |
Oracle第三方工具: PL/SQL developer(F5) Toad (Ctrl+E)
測(cè)試的數(shù)據(jù) 51萬多條數(shù)據(jù)
CID (編號(hào))
companyname(公司名稱)
Ctelephone (電話)
Phonetype (電話類型)
companyinfo (公司地址相關(guān)信息)
Rdatetime
booleanstate
***條測(cè)試語句
搜索包含“武大”的地址信息
- select * from dbo.total where companyname like '%武大%'
SQL Server 2005測(cè)試語句
- declare @starttime as datetime;
- declare @endtime as datetime;
- set @starttime = getdate();
- select * from dbo.total where companyinfo like '%武大%' set @endtime = getdate();
- select @starttime as 開始時(shí)間,@endtime as 結(jié)束時(shí)間,datediff(MS,@starttime,@endtime)as 運(yùn)行時(shí)間
運(yùn)行的結(jié)果: 4.5秒左右:
Oracle執(zhí)行
- Set timing on;
- select * from dbo.total
- where companyname like '%武大%'
運(yùn)行時(shí)間 18.5秒左右:
第二次多條語句搜索
SQL Server代碼
- declare @starttime as datetime;
- declare @endtime as datetime;
- set @starttime = getdate();
- select * from dbo.total where companyinfo like '%華樂商務(wù)中心%'
- select * from dbo.total where companyinfo like '%聯(lián)合國際%'
- select * from dbo.total where companyinfo like '%金豐大廈%'
- select * from dbo.total where companyinfo like '%光谷國際%'
- select * from dbo.total where companyinfo like '%國際商務(wù)大廈%'
- set @endtime = getdate();
- select @starttime as 開始時(shí)間,@endtime as 結(jié)束時(shí)間,datediff(MS,@starttime,@endtime)as 運(yùn)行時(shí)間
執(zhí)行的時(shí)間與17秒左右
Sql/Plus命令中執(zhí)行
執(zhí)行的時(shí)間與39秒左右
Executed in 10.906 seconds
Executed in 5.078 seconds
Executed in 10.218 seconds
Executed in 10.218 seconds
Executed in 3.141 seconds
在進(jìn)程中SQL Server 2005和Oracle占用內(nèi)存 都是200M左右!
從結(jié)果可以看出50多萬數(shù)據(jù)中SQL Server 2005明顯速度優(yōu)勢(shì)大于Oracle 10g。
原文標(biāo)題:Oracl 10G與sql server2005搜索運(yùn)行時(shí)間測(cè)試
鏈接:http://www.cnblogs.com/and/archive/2010/04/12/1710363.html
【編輯推薦】
- SQL Server使用索引實(shí)現(xiàn)數(shù)據(jù)訪問優(yōu)化
- SQL Server數(shù)據(jù)庫優(yōu)化經(jīng)驗(yàn)總結(jié)
- 如何使用SQLServer數(shù)據(jù)庫查詢累計(jì)值
- 淺析Oracle和SqlServer存儲(chǔ)過程的調(diào)試、出錯(cuò)處理
- 幾段SQLServer語句和存儲(chǔ)過程
- 50種方法優(yōu)化SQL Server數(shù)據(jù)庫查詢