ColumnValues访问效率更高?
在一些资料和帮助上看到说通过ColumnValues访问效率更高,做了个实验,发现效率并不快(甚至更慢),希望有经验的高手指教
数据库类型 文档数 访问方式 访问时间
本地 50,005 域名 9,9,9
本地 50,005 ColumnValues 10,11,11,
局域网 1,008 域名 6,7,6
局域网 1,008 ColumnValues 6,6,7
同一种数据库类型两种访问方式交替执行3次,以下是运行程序:
Dim uiw As New NotesUIWorkspace
Dim view As NotesView
Dim doc As NotesDocument
Dim strTemp As String
Dim i As Integer
Dim dt1 As NotesDateTime
Dim dt2 As NotesDateTime
Set view=uiw.CurrentView.View
For i=1 To 3
Set doc=view.GetFirstDocument()
Set dt1=New NotesDateTime(Now())
While Not doc Is Nothing
strTemp=Cstr(doc.a(0)+doc.b(0)+doc.c(0)+doc.d(0)+doc.e(0)+doc.f(0)+doc.h(0)+doc.i(0))
Set doc=view.GetNextDocument(doc)
Wend
Set dt2=New NotesDateTime(Now())
Print "M1:" + Cstr(dt2.TimeDifferenceDouble(dt1))
Set doc=view.GetFirstDocument()
Set dt1=New NotesDateTime(Now())
While Not doc Is Nothing
strTemp=Cstr(doc.ColumnValues(1)+doc.ColumnValues(2)+doc.ColumnValues(3)+doc.ColumnValues(4) _
+doc.ColumnValues(5)+doc.ColumnValues(6)+doc.ColumnValues(7)+doc.ColumnValues(8))
Set doc=view.GetNextDocument(doc)
Wend
Set dt2=New NotesDateTime(Now())
Print "M2:" + Cstr(dt2.TimeDifferenceDouble(dt1))
Next
Print "the end"