Fix BRIN minmax-multi distance for tid values The distance function for tid values maps item pointers to float8 as
(block * MaxHeapTuplesPerPage + offset) but the multiplication was done in uint32 arithmetic, so for high block values (above 14759338, ~112GB) the result wrapped around. The distance would then be very inaccurate (possibly negative), resulting in a less efficient index. Fix by doing the arithmetics in double. It's also possible the (user-supplied) item pointers have offsets greater than MaxHeapTuplesPerPage, confusing the mapping to double value. This commit does not try to address that, it's not clear what would be a better mapping. Author: Tomas Vondra <[email protected]> Backpatch-through: 14 Discussion: https://postgr.es/m/CALdSSPgBvXz-VSF0p-5k%3D_uFfN38cWrERmm_AC4K67N6MWQhmg%40mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/252432c4cf1425d065cf12eb8aa9d59209233513 Modified Files -------------- src/backend/access/brin/brin_minmax_multi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
