Home > Database > Mysql Tutorial > Oracle中的模糊查询_MySQL

Oracle中的模糊查询_MySQL

WBOY
Release: 2016-06-01 13:59:25
Original
933 people have browsed it

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%'差不多。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template