sqlite 查询速度比较

本文通过在macOS上使用SQLProforSQLiteReadOnly版,对多种SQL查询语句进行了性能对比,包括不同条件筛选、排序及限制结果数量等场景,展示了在不同查询条件下的执行时间,为优化数据库查询效率提供了参考。

以下是在  macOS 上使用 SQLPro for SQLite Read Only 版进行的查询速度对比。

 

select word from words_table where word >= '小' and word < '少' order by wordfrq desc           0.4s

select word,wordfrq from words_table where word >= '小' and word < '少'        未按 wordfrq 排序,0.5s

select word from words_table where word like '小%'               未按 wordfrq 排序,0.48s

select word from words_table where word like '小%' order by wordfrq desc         0.67s

select word,wordfrq from words_table where word like '小%'                    0.67s

select word,wordfrq from words_table where word like '小%' limit 100        0.52s

select word,wordfrq from words_table where word like '小%' limit 20     有按 wordfrq 排序 0.52s

select word from words_table where word >= '小' and word < '少' order by wordfrq desc limit 100    0.3s

select word from words_table where word >= '小' and word < '少' order by wordfrq desc limit 20   0.2s

select word,wordfrq from words_table where word glob '小*' limit 20         未按 wordfrq 排序      0.1s

select word from words_table where word glob '小*' order by wordfrq desc limit 20    0.2s

 

 

select word from words_table where stroke like '31%y1z32%'             0.86s

select word from words_table where stroke like '31%y1z32%'  order by wordfrq desc              0.85s

select word from words_table where stroke like '31%y1z32%'  order by wordfrq desc limit 100   0.84s

select word from words_table where stroke like '31%y1z32%' and wordlength == '2' order by wordfrq desc limit 20     0.84s

select word from words_table where stroke like '%y1z32%' and stroke in (select stroke from words_table where stroke like '31%')      0.41s

select word from words_table where stroke like '%y1z32%' and stroke in (select stroke from words_table where stroke like '31%') order by wordfrq desc     0.408s

select word from words_table where stroke like '%y1z32%' and stroke in (select stroke from words_table where stroke like '31%') order by wordfrq desc limit 100     0.405s

select word from words_table where stroke like '%y1z32%' and stroke in (select stroke from words_table where stroke like '31%') order by wordfrq desc limit 20     0.405s

select word from words_table where stroke like '%y1z32%' and stroke in (select stroke from words_table where stroke like '31%') and wordlength == '2' order by wordfrq desc limit 20     0.405s

select word from words_table where stroke like '%y1z32%' and stroke in (select stroke from words_table where stroke like '31%' and wordlength == '2') order by wordfrq desc limit 20     0.38s

select word from words_table where stroke like '31%y1z32%' and stroke in (select stroke from words_table where stroke like '31%' and wordlength == '2') order by wordfrq desc limit 20     0.174s

select word from words_table where stroke >= '31%y1z32' and stroke in (select stroke from words_table where stroke >= '31' and wordlength == '2') order by wordfrq desc limit 20   0.485s

select word from words_table where stroke glob '31*y1z32*' and stroke in (select stroke from words_table where stroke glob '31*' and wordlength == '2') order by wordfrq desc limit 20  0.156s
 

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值