20万行的slqite3数据库能否2ms内完成查询结果并输出?详情如下:

各位神




```节日快乐:

        手机端的sqlite3 存了20万行左右的英文、汉字‘1-4个)为主、大约10列左右的数据库,建立了数字或者英文索引,每次查询几乎都需要like%查询,需要获取查询结果耗时在2ms内。

现在有两个问题:1.索引建立有时间吗?我发现第一次查时无论如何都要耗费20-40ms,是索引写入内存的必须时间吗?即使提前进行虚拟查询似乎也不起作用。

2.现在的查询时间最快也要在15-60ms之间,有什么好办法吗?

下面是我中等复杂的sql查询语句,其中pre_first字段是索引

else {
    if (!separator_sp) {
        String F2 = f1+STRB.substring(valueLength_fst,valueLength_fst+1);
        String F3 = F2+ STRB.substring(sum_fs,sum_fs+1);
        String s = STRB.substring(0,separatorWL+1);
        String s1 = STRB.substring(0, valueLength_fst);
        String s2 = STRB.substring(0, sum_fs);
        String sql = "select word,pinyin from test02 where pre_first in" +
                "('"+F3+"','"+F2+"','"+f1+"') and (py_pre like " +
                "'" + s + "%' or py_pre in('" + s2 + "','" + s1 + "')) " +
                "order by score,null";
        Cursor cu;
        Log.v(TAG, "row2440"+" F3:"+F3+"; F2:"+F2);
        cu = db.rawQuery(sql,null);
        while (cu.moveToNext()) {
            String hanziIndex1 = cu.getString(cu.getColumnIndex("word"));
            String hanziIndex2 = cu.getString(cu.getColumnIndex("pinyin"));
            list_decodingWord.add(hanziIndex1);
            list_decodingPY.add(hanziIndex2);
            if (string_comosingPY.length() == 0) {
                if (hanziIndex2.length() > separatorWL + 2) {
                    string_comosingPY.append(hanziIndex2.substring(0, separatorWL + 3));
                } else {
                    string_comosingPY.append(hanziIndex2);
                }
            }
        }
        //Log.v(TAG, "row2093"+" strCom:"+string_comosingPY+"; s:"+s+"; s1:"+s1+"; s2"+s2);
        cu.close();
        long endTime = System.currentTimeMillis();
        Log.e(TAG,"ROW2450 汉字数据库搜索运行时间: " + (endTime - startTime) + "ms");
        if (string_comosingPY.length() == sum_fs+1) {
            string_comosingPY.append("'");
            string_comosingPY.append(STRB.substring(separatorWL, separatorWL+1));
        } else {
            if(string_comosingPY.length()==valueLength_fst){
                string_comosingPY.append("'");
                string_comosingPY.append(str_fstSec);
                string_comosingPY.append("'");
                string_comosingPY.append(STRB.substring(separatorWL, separatorWL+1));
            }
        }
        //Log.v(TAG, "row2097");
    }
}

```

加索引为word,pinyin,做全文覆盖试试。

谢谢大侠,
1.加索引还没试,应该是有用,我测试下
2.全文覆盖指的是直接把搜索结果也作为索引不用再回表了吗?