关于rs.open和conn.execute的性能对比

===============================================
Dim t1,t2,t3,i,Rs,a1,a2,a3
t1=timer
OpenConn
For i=1 To 1000
Set Rs=Conn.Execute("SELECT COUNT(*) FROM CE_Admin")
Rs.Close:Set Rs=Nothing
Next
t2=timer
t3=cstr(int(( (t2-t1)*10000 )+0.5)/10)
Response.Write t3
读取数据的时间(共10次,去掉读取时间一样的)
4390.6 4359.4 4468.8 4796.9 4703.1 4734.4 4843.8 4796.9 4781.3 4531.3
平均:4640.65
===============================================
===============================================
Dim t1,t2,t3,i,Rs,a1,a2,a3
t1=timer
OpenConn
For i=1 To 1000
Set Rs=Server.Createobject("ADODB.RecordSet")
Rs.Open "SELECT COUNT(*) FROM CE_Admin",conn,0,1
Rs.Close:Set Rs=Nothing
Next
t2=timer
t3=cstr(int(( (t2-t1)*10000 )+0.5)/10)
Response.Write t3
读取数据的时间(共10次,去掉读取时间一样的)
5015.6 4984.4 4937.5 4953.1 4765.6 5000 4953.1 4875 4828.1 4906.3
平均:4921.87
===============================================
===============================================
Dim t1,t2,t3,i,Rs,a1,a2,a3
t1=timer
OpenConn
Set Rs=Server.Createobject("ADODB.RecordSet")
For i=1 To 1000
Rs.Open "SELECT COUNT(*) FROM CE_Admin",conn,0,1
Rs.Close
Next
t2=timer
t3=cstr(int(( (t2-t1)*10000 )+0.5)/10)
Response.Write t3
读取数据的时间(共10次,去掉读取时间一样的)
4687.5 4718.8 4734.4 4718.8 4703.1 4843.8 4765.6 4687.5 4890.6 4984.4
平均:4773.45
===============================================
===============================================
Dim t1,t2,t3,i,Rs,a1,a2,a3
t1=timer
OpenConn
Set Rs=Server.Createobject("ADODB.RecordSet")
For i=1 To 1000
Rs.Open "SELECT TOP 1 AdminName,UserID,UserName FROM CE_Admin",conn,0,1
a1="":a1=Rs(0):a2="":a2=Rs(1):a3="":a3=Rs(2)
Rs.Close
Next
t2=timer
t3=cstr(int(( (t2-t1)*10000 )+0.5)/10)
Response.Write t3
读取数据的时间(共10次,去掉读取时间一样的)
5187.5 5234.4 5125 5109.4 5296.9 5531.3 5718.8 5921.9 6156.3 6375
平均:5565.65
===============================================
===============================================
Dim t1,t2,t3,i,Rs,a1,a2,a3
t1=timer
OpenConn
For i=1 To 1000
Set Rs=Server.Createobject("ADODB.RecordSet")
Rs.Open "SELECT TOP 1 AdminName,UserID,UserName FROM CE_Admin",conn,0,1
a1="":a1=Rs(0):a2="":a2=Rs(1):a3="":a3=Rs(2)
Rs.Close:Set Rs=Nothing
Next
t2=timer
t3=cstr(int(( (t2-t1)*10000 )+0.5)/10)
Response.Write t3
读取数据的时间(共10次,去掉读取时间一样的)
5015.6 4984.4 5125 4921.9 5062.5 5250 5421.9 5546.9 5671.9 5906.3
平均:5290.64
===============================================
===============================================
Dim t1,t2,t3,i,Rs,a1,a2,a3
t1=timer
OpenConn
For i=1 To 1000
Set Rs=Conn.Execute("SELECT TOP 1 AdminName,UserID,UserName FROM CE_Admin")
a1="":a1=Rs(0):a2="":a2=Rs(1):a3="":a3=Rs(2)
Rs.Close
Next
t2=timer
t3=cstr(int(( (t2-t1)*10000 )+0.5)/10)
Response.Write t3
读取数据的时间(共10次,去掉读取时间一样的)
6000 5609.4 5781.3 5890.6 7234.4 5765.6 5828.1 6546.9 6593.8 6437.5
平均:6168.76
===============================================
===============================================
Dim t1,t2,t3,i,Rs,a1,a2,a3
t1=timer
OpenConn
For i=1 To 1000
Set Rs=Conn.Execute("SELECT TOP 1 AdminName,UserID,UserName FROM CE_Admin")
a1="":a1=Rs(0):a2="":a2=Rs(1):a3="":a3=Rs(2)
Rs.Close:Set Rs=Nothing
Next
t2=timer
t3=cstr(int(( (t2-t1)*10000 )+0.5)/10)
Response.Write t3
读取数据的时间(共10次,去掉读取时间一样的)
6312.5 5843.8 6281.3 6515.6 8093.8 7406.3 7312.5 7828.1 7890.6 8109.4
平均:7159.39
===============================================

阅读更多
个人分类: asp技术 sql
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭