How to Use amcheck to Check PostgreSQL Index Integrity (Corruption)

Lately, I have read a number of Discourse topics on meta about “index corruption” in both PostgreSQL 10 and 12.

One of the take-a-ways from these discussions is that it may be important or interesting for some sys admins to check the integrity of their Discourse PostgreSQL 10 indexes if they are experiencing performance problems or perhaps before performing an upgrade to PostgreSQL 12.

For those who might want to perform this check, I have tested amcheck on two differernt Discourse (PostgreSQL 10) installations. The check went flawlessly on both a (1) “two container” setup and a (2) standalone single container setup.

Here is my discussion on how to check for index corruption for Discourse PostgreSQL 10 configurations, and my results:

I hope this brief write up on amcheck and Discourse (PostgreSQL 10) will help any Discourse sys admin who may be interested in using amcheck to check their DBs for corrupt indexes.