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