When Good Correlation is Not Enough
Choosing to use a block range index (BRIN) to query a field with high correlation is a no-brainer for the optimizer. However, under some easily reproducible circumstances, a BRIN index can result in significantly slower execution even when the indexed field has very high correlation. In this article I describe how using a BRIN index in presumably "ideal circumstances" can result in degraded performance, and suggest a recent new feature of PostgreSQL as a remedy.