您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

Oracle中的模糊查询_MySQL

2024/3/11 17:11:14发布20次查看
oracle数据库支持类似于 like  '%界面%'这种格式的对字符串的模糊查询。
为了得出其查询速度快或慢的结论,做了如下实验:
(1)在赵老师的机器上产生了一个10万条记录的表,不过它只有一个长度为1000 类型为varchar 的字段。
(2)在vb程序中书写了如下程序段
dim db as new adodb.connection
dim adoprimaryrs as new adodb.recordset
db.cursorlocation = aduseclient
db.open provider=msdasql;driver={microsoft odbc for oracle};server=zl;uid=zlhis;pwd=his;
adoprimaryrs.cursorlocation = aduseclient
adoprimaryrs.cursortype = adopenstatic
adoprimaryrs.locktype = adlockbatchoptimistic
debug.print time, timer
set adoprimaryrs = db.execute(select name from test where name like '%中国国%' )
debug.print time, timer
(3)经多次运行,并把匹配串改为如'%1%','%aklsdjflsasdfasd%'等,发现所耗时间在5——10秒之间波动,其值与匹配串的长度、返回记录的数量都关系。而与记录集的cursorlocation等属性关系不大。
(4)后来我把匹配串改成'34%'之类的格式,结果所耗时间一般在3秒左右,比较稳定。
(5)最后我把匹配串改成'%34'之类的格式,结果所耗时间与'%34%'差不多。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product