top | item 41228719

(no title)

dogsledsleddog | 1 year 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?

discuss

order

shayonj|1 year ago

Reindex starts fresh on a temp index and then does a swap in the end - https://www.postgresql.org/docs/current/sql-reindex.html

dogsledsleddog|1 year ago

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.)