[分享]ORACLE全文索引测试2_MySQL, Oracle及数据库讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  MySQL, Oracle及数据库讨论区 »
总帖数
2
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 2026 | 回复: 1   主题: [分享]ORACLE全文索引测试2        下一篇 
game
注册用户
等级:新兵
经验:36
发帖:61
精华:0
注册:2011-7-23
状态:离线
发送短消息息给game 加好友    发送短消息息给game 发消息
发表于: IP:您无权察看 2015-1-20 17:47:14 | [全部帖] [楼主帖] 楼主

创建词分析器

BEGIN
CTX_DDL.DROP_PREFERENCE('MY_CHINESE_LEXER');
CTX_DDL.DROP_PREFERENCE('MY_CHINESEWORDLIST');
CTX_DDL.CREATE_PREFERENCE('MY_CHINESE_LEXER','CHINESE_VGRAM_LEXER');
CTX_DDL.CREATE_PREFERENCE('MY_CHINESEWORDLIST','BASIC_WORDLIST');
CTX_DDL.SET_ATTRIBUTE('MY_CHINESEWORDLIST','PREFIX_INDEX','TRUE');
CTX_DDL.SET_ATTRIBUTE('MY_CHINESEWORDLIST','PREFIX_MIN_LENGTH',1);
CTX_DDL.SET_ATTRIBUTE('MY_CHINESEWORDLIST','PREFIX_MAX_LENGTH',5);
CTX_DDL.SET_ATTRIBUTE('MY_CHINESEWORDLIST','SUBSTRING_INDEX','YES');
END;
/


创建索引:时间消耗40分钟

CREATE INDEX IND_JYC ON JR_COVER_ADDRESS_JYC(TOTAL_ADDRESS) INDEXTYPE IS CTXSYS.CTXCAT
PARAMETERS ('LEXER MY_CHINESE_LEXER WORDLIST MY_CHINESEWORDLIST');


删除索引:drop index IND_JYC;

SQL> conn gistar/gistar


已连接。

SQL> select status from user_indexes where index_name='IND_JYC';
STATUS
--------
INPROGRS
SQL> select table_name from user_tables where table_name like 'DR%';
TABLE_NAME
------------------------------
DR$IND_JYC$I
DR$IND_JYC$P
DRAG_LINE
SQL> select status from user_indexes where index_name='IND_JYC';
STATUS
--------
INPROGRS
SQL> select status from user_indexes where index_name='IND_JYC';
STATUS
--------
INPROGRS
SQL> select count(*) from JR_COVER_ADDRESS_JYC where catsearch(TOTAL_ADDRESS,'雅世合金',null)>0 and catsearch
(TOTAL_ADDRESS,'1',null)>0;
select count(*) from JR_COVER_ADDRESS_JYC where catsearch(TOTAL_ADDRESS,'雅世合金',null)>0 and catsearch
(TOTAL_ADDRESS,'1',null)>0
*


ERROR 位于第 1 行:

ORA-20000: Oracle Text error:


DRG-10849: catsearch 不支持函数调用

SQL> select status from user_indexes where index_name='IND_JYC';
STATUS
--------
INPROGRS
SQL> /
STATUS
--------
INPROGRS
SQL> /
STATUS
--------
VALID
SQL> select count(*) from JR_COVER_ADDRESS_JYC where catsearch(TOTAL_ADDRESS,'雅世合金',null)>0 and catsearch
(TOTAL_ADDRESS,'1',null)>0;
COUNT(*)
----------
284
SQL> select count(*) from JR_COVER_ADDRESS_JYC where catsearch(TOTAL_ADDRESS,'雅世合金',null)>0;
COUNT(*)
----------
513
SQL> select count(*) from JR_COVER_ADDRESS_JYC where catsearch(TOTAL_ADDRESS,'1',null)>0;
COUNT(*)
----------
52583
SQL>


SQL> select count(*) from JR_COVER_ADDRESS where total_address like '%雅世合金%';

COUNT(*)
----------
513
SQL> select count(*) from JR_COVER_ADDRESS where total_address like '%1';
COUNT(*)
----------
21039


SQL> select count(*) from JR_COVER_ADDRESS where total_address like '%雅世合金%' and total_address like '%1%';

COUNT(*)
----------
360
SQL> select count(*) from JR_COVER_ADDRESS_JYC where catsearch(TOTAL_ADDRESS,'雅世合金 1',null)>0;
COUNT(*)
----------
284
SQL> select count(*) from JR_COVER_ADDRESS_JYC where catsearch(TOTAL_ADDRESS,'1 雅世合金',null)>0;
COUNT(*)
----------
284


SQL> select count(*) from JR_COVER_ADDRESS where total_address like '%雅世合金 1%';

COUNT(*)
----------
0


SQL> select count(*) from JR_COVER_ADDRESS where total_address like '%1 雅世合金%';

COUNT(*)
----------
0
SQL> select table_name from user_tables where table_name like 'DR%';
TABLE_NAME
------------------------------
DR$IND_JYC$I
DR$IND_JYC$P
DRAG_LINE
SQL> select status from user_indexes where index_name='IND_JYC';
STATUS
--------
VALID
SQL> select sum(bytes)/1024/1024 from user_segments where segment_name='DR$IND_JYC$I';
SUM(BYTES)/1024/1024
--------------------
138
SQL> select sum(bytes)/1024/1024 from user_segments where segment_name='DR$IND_JYC$P';
SUM(BYTES)/1024/1024
--------------------
SQL> select sum(bytes)/1024 from user_segments where segment_name='DR$IND_JYC$P';
SUM(BYTES)/1024
---------------
SQL> select sum(bytes) from user_segments where segment_name='DR$IND_JYC$P';
SUM(BYTES)
----------
SQL> select count(*) from DR$IND_JYC$P;
COUNT(*)
----------
7673
SQL> select count(*) from DR$IND_JYC$I;
COUNT(*)
----------
4915909
SQL> explain plan for select id,total_address from JR_COVER_ADDRESS_JYC where catsearch(TOTAL_ADDRESS,'雅世合金',null)>0 and
catsearch(TOTAL_ADDRESS,'1',null)>0;


已解释。

SQL> set line 132
SQL> set * from table(dbms_xplan.display);


SP2-0158: 未知的SET选项"*"

SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
-------------------------------------------------------------------------------------------------------------------------------
-----
------------------------------------------------------------------------------------------
| Id  | Operation                        |  Name                 | Rows  | Bytes | Cost  |
------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT                 |                       |   490 |   265K|   175 |
|   1 |  TABLE ACCESS BY INDEX ROWID     | JR_COVER_ADDRESS_JYC  |   490 |   265K|   175 |
|   2 |   BITMAP CONVERSION TO ROWIDS    |                       |       |       |       |
|   3 |    BITMAP AND                    |                       |       |       |       |
|   4 |     BITMAP CONVERSION FROM ROWIDS|                       |       |       |       |
|   5 |      SORT ORDER BY               |                       |       |       |       |
|   6 |       DOMAIN INDEX               | IND_JYC               |       |       |       |
PLAN_TABLE_OUTPUT
-------------------------------------------------------------------------------------------------------------------------------
-----
|   7 |     BITMAP CONVERSION FROM ROWIDS|                       |       |       |       |
|   8 |      SORT ORDER BY               |                       |       |       |       |
|   9 |       DOMAIN INDEX               | IND_JYC               |       |       |       |
------------------------------------------------------------------------------------------
Note: cpu costing is off, PLAN_TABLE' is old version


已选择17行。

SQL> explain plan for select id,total_address from JR_COVER_ADDRESS where total_address like '%雅世合金%' and total_address

like '%1%';


已解释。

SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
-------------------------------------------------------------------------------------------------------------------------------
-----
------------------------------------------------------------------------------
| Id  | Operation            |  Name                 | Rows  | Bytes | Cost  |
------------------------------------------------------------------------------
|   0 | SELECT STATEMENT     |                       |   244 | 16836 |     4 |
|   1 |  INDEX FAST FULL SCAN| PRI_COVER_ADDRESS_ID  |   244 | 16836 |     4 |
------------------------------------------------------------------------------
Note: cpu costing is off, PLAN_TABLE' is old version


已选择9行。

SQL> explain plan for select id,total_address from JR_COVER_ADDRESS_JYC where total_address like '%雅世合金%' and total_address

like '%1%';


已解释。

SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
-------------------------------------------------------------------------------------------------------------------------------
-----
------------------------------------------------------------------------------
| Id  | Operation            |  Name                 | Rows  | Bytes | Cost  |
------------------------------------------------------------------------------
|   0 | SELECT STATEMENT     |                       |   490 |   262K|   233 |
|   1 |  TABLE ACCESS FULL   | JR_COVER_ADDRESS_JYC  |   490 |   262K|   233 |
------------------------------------------------------------------------------
Note: cpu costing is off, PLAN_TABLE' is old version


已选择9行。

SQL> set timing on
SQL> select count(*) from JR_COVER_ADDRESS_JYC where catsearch(TOTAL_ADDRESS,'雅世合金 1',null)>0;
COUNT(*)
----------
284


已用时间:  00: 00: 00.22
SQL> select count(*) from JR_COVER_ADDRESS where total_address like '%雅世合金%' and total_address like '%1%';

COUNT(*)
----------
360


已用时间:  00: 00: 00.88

SQL> select count(*) from JR_COVER_ADDRESS_JYC where catsearch(TOTAL_ADDRESS,'雅世合金 1',null)>0;
COUNT(*)
----------
284


已用时间:  00: 00: 00.22
SQL> select count(*) from JR_COVER_ADDRESS where total_address like '%雅世合金%' and total_address like '%1%';

COUNT(*)
----------
360


已用时间:  00: 00: 00.89

SQL>


--转自 北京联动北方科技有限公司




赞(0)    操作        顶端 
running
注册用户
等级:中尉
经验:491
发帖:0
精华:0
注册:2015-1-20
状态:离线
发送短消息息给running 加好友    发送短消息息给running 发消息
发表于: IP:您无权察看 2015-1-20 23:33:01 | [全部帖] [楼主帖] 2  楼

北京联动北方科技有限公司



赞(0)    操作        顶端 
总帖数
2
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论