以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  谁有大规模数据库 帮我测试下这两个自定义函数的效率  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=24444)

--  作者:Fotable
--  发布时间:2012/10/14 10:33:00
--  谁有大规模数据库 帮我测试下这两个自定义函数的效率

\'自定义函数Vlookup1 0 表名,1查找列,2查找值,3返回值列

dim dr as datarow = datatables(args(0)).find(args(1) & "= \'" & args(2) & "\'")
if dr isnot nothing then
return dr(args(3))
else
return nothing
end if

\'自定义函数Vlookup2 0 表名,1查找列,2查找值,3返回值列
dim r as integer = tables(args(0)).find(args(2),0,args(1),false,true,false)
if r> -1 then
return tables(args(0)).rows(r)(args(3))
else
return nothing
end if

 

\'测试效率
Dim st As Date = Date.Now
functions.execute("vlookup1",表名,查找列,查找值,返回值列)
MessageBox.Show("vlookup1耗时: " & (Date.Now - st).TotalSeconds & "秒")
st = now
functions.execute("vlookup2",表名,查找列,查找值,返回值列)
MessageBox.Show("vlookup2耗时: " & (Date.Now - st).TotalSeconds & "秒")


--  作者:lihe60
--  发布时间:2012/10/14 10:46:00
--  
效率的高低与数据库的大小没有必然的联系。
--  作者:Fotable
--  发布时间:2012/10/14 10:52:00
--  

效率的高低 决定于代码的本身

但要测试,必须使用大规模数据表,才能放大差距


--  作者:Fotable
--  发布时间:2012/10/14 14:21:00
--  
帮忙测试一下
--  作者:wfkbabro
--  发布时间:2012/11/1 14:37:00
--  

多大规模的啊,>多少条的?以前下载过一个软件自动填写N条数据到SQL的,要不你自己搭建一个吧