> Interested to hear comments on this.
I don't have chance to test it right now, but I am sure it would be animprovement over what we have right now. There is no single correctequation with so many unknowns we have.
> *indexTotalCost += (numTuples * *indexSelectivity) *(cpu_index_tuple_cost + qual_op_cost);
Have you preserved this line intentionally? This would make BRIN indexscan cost even higher, but the primary property of BRIN is to be cheap toscan. Shouldn't bitmap heap scan node take into account of checking thetuples in its cost?