Some time ago, a customer came to us with a strange vacuuming problem. Their regular vacuum job would die with a message such as this one:
vacuumdb: vacuuming of database "clint_app" failed: ERROR: failed to re-find parent key in index "work_items_pkey" for deletion target page 6100
Eventually, it turned out that their storage firmware had some glitch that caused things to go wrong in random ways, and corruption in various places was detected.
However, before this was discovered, many other errors were found and reported. After a lot of back and forth, we decided to write a simple tool to verify the data contained in btree indexes. This tool would scan the index structure and traverse the tree, reporting places on which the nodes and leaves didn't align with expectations.
I've mentioned this tool at various times in mailing lists and such, and given to a few customers. It has proven useful to determine whether a given problem is some sort of hardware problem that's causing widespread usage, or something localized. I've now published the code in Github.
This is very rough around the edges, and there are more checks that could be written given sufficient interest.
If you find it useful, please let me know in a comment.