SQLite FTS3 性能不一致

发布于 2024-08-30 07:49:24 字数 218 浏览 4 评论 0原文

大约有 100k 行的表。

SELECT word FROM entries WHERE word MATCH '"chicken *"';
17 results in 46ms
SELECT word FROM entries WHERE word MATCH '"chicken f*"';
2 results in 5793ms

为何跌幅如此之大?

A table with ~100k rows.

SELECT word FROM entries WHERE word MATCH '"chicken *"';
17 results in 46ms
SELECT word FROM entries WHERE word MATCH '"chicken f*"';
2 results in 5793ms

Why such a huge drop?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

故人如初 2024-09-06 07:49:24

“chicken *”中的通配符可以有效地被忽略,因为它完全匹配任何标记。搜索是反向索引中的简单查找。

“chicken f*”中的通配符需要查找所有以 f 开头且包含“chicken”单词的条目。可以理解的是,它更复杂、更慢。

The wildcard in "chicken *" can effectively be ignored as it matches any token at all. The search is a simple lookup in the reverse index.

The wildcard in "chicken f*" needs to find all entries with words beginning with f, that also contain the word chicken. It is understandably more complicated and slower.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文