select * from xxfl where hphm like '%452%';
ORACLE执行这条语句时很慢,知道模糊查询时不走索引,请教各位怎样可以加快这条语句的执行速度.

解决方案 »

  1.   

    select * from xxfl where instr(hphm ,'452')>0
    试试。
      

  2.   

    如果"452"位置固定,用substr试试
      

  3.   

    经过测试instr确实比like要快
    SQL> select count(*) from xgwzgl.dbbjzb_jh where gcbh like '%1%'; COUNT(*)
    ---------
         6706实际:94
    SQL>  select count(*) from xgwzgl.dbbjzb_jh where instr(gcbh,'1')>0; COUNT(*)
    ---------
         6706实际:62
      

  4.   

    SQL> select count(*) from xgwzgl.dbbjzb_jh where gcbh like '%1%'; COUNT(*)
    ---------
         6706实际:94
    SQL>  select count(*) from xgwzgl.dbbjzb_jh where instr(gcbh,'1')>0; COUNT(*)
    ---------
         6706实际:62
    insert快!
      

  5.   

    SQL> select clbh from xxfl where instr(clbh,'384')>0;      CLBH
    ----------
      50773384如果只知道50773384中的0,3,4等几个数字,该怎样查询,怎样加快其查询速度
    select clbh from xxfl where clbh like '%0%3%4%'>0;
    这样写是不行的,因为每次查询知道的那几个数字都是随机的,那几个数字的位置也是随机的,该怎么办
      

  6.   

    可以试试下面这个方式
    Domain indexes 应用域索引
    应用域索引(application domain index)即Oracle所谓的可扩展索引(extensible indexing)。利用应用域索引,你可以创建自己的索引结构,使之像Oracle提供的索引一样工作。
    对此最好的例子是Oracle自己的文本索引(text index)。这个索引用于对大量的文本项提供关键字搜索。可以如下创建一个简单的文本索引:
    create index xxfl_index on xxfl(hphm) indextype is ctxsys.context;
    select * from xxfl x where contains(hphm,'452')>0;