Hacker News new | ask | show | jobs
by dogsledsleddog 672 days ago
I hope I am missing something in this logic?:

Broken indexes are intentionally left because indexing can be a long operation on a big db, so you may regret not just repairing them..

Let's delete and recreate indexes all the time, just in case because they might be left over..

Hope we don't encounter the reason they left broken indexes and wait a few hours for a rebuild?

1 comments

Reindex starts fresh on a temp index and then does a swap in the end - https://www.postgresql.org/docs/current/sql-reindex.html
That's very helpful, but I still don't get the recommendation. The reindex seems to guarantee that any useful index will be used, the deletion and recreation seems to guarantee a period of bad performance as long as an index takes to build even if the old one was fine.

(I.e. I could imagine a customer upgrading from a version that already backported an index to the new major version where it was added and deciding there's a performance regression.)