小编Joh*_*ohn的帖子

Sqlite3比grep慢约6倍

我有一个188万行的表和一个188万行的文本文件,如下所示:

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
Run Code Online (Sandbox Code Playgroud)

或者更复杂的查询

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
Run Code Online (Sandbox Code Playgroud)

有什么方法可以加快sqlite3吗?

python sqlite bash grep

3
推荐指数
1
解决办法
363
查看次数

标签 统计

bash ×1

grep ×1

python ×1

sqlite ×1