TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Introducing HypoPG, hypothetical indexes for PostgreSQL

145 pointsby narfzalmost 10 years ago

6 comments

ninkendoalmost 10 years ago
So presumably you could do the following on your entire database:<p><pre><code> for each query in my codebase Q: for each possible combination of indexes I for Q: create hypothetical index I run EXPLAIN query Q if Q uses I, create I </code></pre> If EXPLAIN doesn&#x27;t actually run a query, and creating hypothetical indexes doesn&#x27;t actually write anything, the above could presumably done in milliseconds, no?<p>Why not take this one step further and just enable an autoindexing mode in postgres using the query history as a heuristic?
评论 #9776170 未加载
评论 #9777672 未加载
jedbergalmost 10 years ago
Combining this with just a bit of programming loops could get you pretty far at automatically creating indexes. Basically take a query plan and then create all possibly indexes hypothetically until you get the most optimal query.
评论 #9775046 未加载
dunkelheitalmost 10 years ago
Cool one! Thankfully postgres allows creating indexes concurrently (without blocking writes) but &#x27;hypothetical indexes&#x27; seem more convenient.<p>What would be even cooler though is the ability to see multiple plans considered (and rejected) by the planner with all associated costs. It often takes a lot of painful guesswork to understand why particular superior plan is not used.
makmanalpalmost 10 years ago
I&#x27;d always wondered why query engines don&#x27;t create such temporary indices, for example in the case of large subquery queries, where creating and index AND doing the query with an index runs way faster in total than waiting for it to run without the index. Any insights on this? I guess predicting the gain could be difficult.
评论 #9774885 未加载
评论 #9774709 未加载
评论 #9774765 未加载
评论 #9775062 未加载
评论 #9775648 未加载
评论 #9775919 未加载
michaelmioralmost 10 years ago
This is quite excellent for those of us doing research in physical schema design. As far as I know, this is the first &quot;what-if&quot; analysis tool integrated into an open source database. Although if there are others, I&#x27;d love to know about them :)
willualmost 10 years ago
One of my major hang-ups about transitioning away from SQL Server to Postgres is the productivity that comes from tools like Profiler and Database Engine Tuning Advisor (which uses hypothetical indexes to find performance improvements). Can anyone suggest analogous tools for Postgres?
评论 #9775188 未加载