我有一个包含1.88亿行的表格,以及一个包含1.88亿行的文本文件,如下所示:
CREATE TABLE trigram (count integer, A text, B text, C text)
time echo 'select * from trigram where C="mailman";'|sqlite3 3g.db
18.419 seconds.
time grep 'mailman$' N-Grams/3g
3.137 seconds
或者一个更复杂的查询,比如
time grep 'the [^ ]* mailman$' N-Grams/3g
2.879 seconds
time echo 'select * from trigram where A="the" and C="mailman";'|sqlite3 3g.db
15.839 seconds
有没有什么方法可以加快 sqlite3
的速度?