> So I basically spent most of the time trying to create a reproducible case > and I can say I failed. I can however reproduce this with specific large > data set with specific data distribution, but not an artificial one.
The query plans posted that has the statistics prefer Bitmap Index Scan. This is not reproduction of the originally posted case. > ** Wait... What??? "Rows Removed by Index Recheck: 1643390" but data is > almost sequential! Let's take a look at it. I don't think it has anything to do with query planning. Have you tried "pages_per_range" option of BRIN?