TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

SQLite's Automatic Indexes

216 点作者 preetamjinka超过 2 年前

9 条评论

banana_giraffe超过 2 年前
Related: <a href="https:&#x2F;&#x2F;sqlite.org&#x2F;cli.html#index_recommendations_sqlite_expert_" rel="nofollow">https:&#x2F;&#x2F;sqlite.org&#x2F;cli.html#index_recommendations_sqlite_exp...</a><p>There&#x27;s an experimental module and CLI command in the normal shell to use this logic to dump out a suggested list of indexes to create for a given SQL command to speed it up.
评论 #34165671 未加载
chasil超过 2 年前
I was not aware that SQLite creates temporary indexes in places where other databases would perform merge joins.<p><a href="https:&#x2F;&#x2F;sqlite.org&#x2F;tempfiles.html#transient_indices" rel="nofollow">https:&#x2F;&#x2F;sqlite.org&#x2F;tempfiles.html#transient_indices</a><p>SQLite also creates background indexes for ROWID, of which I was aware.<p><a href="https:&#x2F;&#x2F;sqlite.org&#x2F;rowidtable.html" rel="nofollow">https:&#x2F;&#x2F;sqlite.org&#x2F;rowidtable.html</a>
评论 #34164322 未加载
评论 #34163195 未加载
评论 #34163468 未加载
high_byte超过 2 年前
I think EXPLAIN is a little known feature that gives a lot of insight about database internals, especially in Sqlite.<p>Funny you posted this now, I just recently researched Sqlite internals for my own project. Maybe you will find it interesting: <a href="https:&#x2F;&#x2F;twitter.com&#x2F;high_byte&#x2F;status&#x2F;1607853384123703296" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;high_byte&#x2F;status&#x2F;1607853384123703296</a><p>Interesting blog, I love that you keep consistency writing for so long.
评论 #34164987 未加载
jaggederest超过 2 年前
Cool details. Makes sense, since a database has to have index creation anyway, and if you&#x27;re avoiding merge joins for code complexity reasons, why not use it to optimize.<p>An interesting project to manage indexes on postgres that seems tangentially related:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;ankane&#x2F;dexter">https:&#x2F;&#x2F;github.com&#x2F;ankane&#x2F;dexter</a>
senderista超过 2 年前
As others already noted, this is equivalent to asymmetric hash join, except less efficient. Constructing a hash table on the fly instead of a B-tree would almost certainly be faster to both build and query. You don’t need an ordered lookup structure for join indexes (unless it’s a merge join, which SQLite doesn’t do anyway).
ayende超过 2 年前
That was interesting to read. RavenDB does something similar, if there isn&#x27;t an index for the query, it will create one for you. The difference is that this is a persistent structure, which is reused across multiple queries and invocations.
评论 #34164662 未加载
forinti超过 2 年前
It might make sense to flag in the metadata that an index might be needed; then again someone using SQLite will probably know very well which queries are being executed.<p>Also, most of the time joins are made on foreign keys and these should always be indexed. So I guess this should be a rare occurrence if the database is properly thought-out.
takeda超过 2 年前
I keep seeing posts like these, and I&#x27;m wondering, whether &quot;lite&quot; still applies. It feels like all it is missing is the network layer and it would have more features than original MySQL.
评论 #34165798 未加载
评论 #34165901 未加载
johndough超过 2 年前
EDIT: I misread. Nevermind!
评论 #34165480 未加载
评论 #34165484 未加载