美文网首页我爱编程
oracle建立全文索引,使用contains替换like,提高

oracle建立全文索引,使用contains替换like,提高

作者: firehole | 来源:发表于2017-04-19 12:04 被阅读0次

大家都知道 条件中使用 like查询不能使用索引,这是想要提高查询效率可以使用全文索引

第一步,创建全文索引

ctx_ddl.create_preference ('my_lexer', 'chinese_vgram_lexer');

chinese_lexer只能是utf-8字符集的oracle

chinese_vgram_lexer支持多种字符集,但对中文检索效率低,很石板

推荐使用chinese_lexer

第二部,使用第一步建立的检索器,生成全局索引

CREATEINDEXmyindexONmytable(mycolumn)indextype is ctxsys.context parameters('lexer my_lexer');

3,使用全局索引

select * from user_info where contains(userID,'%nihao%')

相关文章

网友评论

    本文标题:oracle建立全文索引,使用contains替换like,提高

    本文链接:https://www.haomeiwen.com/subject/tpwczttx.html