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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Understanding database indexes in PostgreSQL

288 点作者 mrpotato将近 2 年前

4 条评论

fabian2k将近 2 年前
That was more detailed than I expected, a lot of posts on this topic tend to be more superficial. I suspect the BRIN index might need a bit of a stronger disclaimer, as far as I understand you really want to use that only for ordered data, and in those cases it is exceptionally good at its job. But it is a lot worse if that condition is not met. The post mentions this a bit, but with very soft language.<p>I disagree a bit with &quot;Don’t index columns if the table has little data&quot;, mostly because it doesn&#x27;t matter in those cases. If the table is tiny the index is also very cheap (unless it&#x27;s something really weird like a tiny table that is written at a very high frequency). And &quot;little data&quot; is just not specific enough for people to make decisions unless they already have a very good intuition on when the query planner would use such an index.<p>A rather important part that isn&#x27;t mentioned about multi-column indexes is which kinds of query can use them. That is probably not obvious if you never read about them in detail, but it&#x27;s really important to know when defining them.
评论 #35985381 未加载
评论 #35981947 未加载
评论 #35981512 未加载
评论 #35982154 未加载
paulddraper将近 2 年前
Wow, this is an excellent article.<p>Two really nice nuggets: how to detect unused and bloated indices.
perlgeek将近 2 年前
For NULLable columns, does it generally make sense make a partial index with &quot;WHERE column IS NOT NULL&quot;?
abrark将近 2 年前
Wow!! This is just awesome about indexing.