Re: BRIN minmax multi - incorrect distance for infinite timestamp/date
Tomas Vondra <tomas.vondra@enterprisedb.com>
From: Tomas Vondra <tomas.vondra@enterprisedb.com>
To: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Cc: Dean Rasheed <dean.a.rasheed@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2023-10-17T20:25:38Z
Lists: pgsql-hackers
Attachments
- 0001-Tests-for-overflows-with-dates-and-timestamps-in-BRI.patch (text/x-patch) patch 0001
- 0002-Fix-overflow-in-brin_minmax_multi_distance_timestamp.patch (text/x-patch) patch 0002
- 0003-Fix-calculation-in-brin_minmax_multi_distance_date.patch (text/x-patch) patch 0003
- 0004-Add-tests-for-inifite-date-timestamp-values.patch (text/x-patch) patch 0004
- 0005-Fix-handling-of-infinity-date-timestamp-values.patch (text/x-patch) patch 0005
- 0006-Add-test-for-BRIN-minmax-multi-with-extreme-interval.patch (text/x-patch) patch 0006
- 0007-Fix-distance-calculation-for-extreme-interval-values.patch (text/x-patch) patch 0007
- 0008-Add-more-tests-for-BRIN-on-interval-values.patch (text/x-patch) patch 0008
Hi, Here's a couple cleaned-up patches fixing the various discussed here. I've tried to always add a regression test demonstrating the issue first, and then fix it in the next patch. In particular, this deals with these issues: 1) overflows in distance calculation for large timestamp values (0002) 2) incorrect subtraction in distance for date values (0003) 3) incorrect distance for infinite date/timestamp values (0005) 4) failing distance for extreme interval values (0007) All the problems except "2" have been discussed earlier, but this seems a bit more serious than the other issues, as it's easier to hit. It subtracts the values in the opposite order (smaller - larger), so the distances are negated. Which means we actually merge the values from the most distant ones, and thus are "guaranteed" to build very a very inefficient summary. People with multi-minmax indexes on "date" columns probably will need to reindex. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Commits
-
Fix minmax-multi distance for extreme interval values
- 0fa73c5cd050 14.10 landed
- 2fbb2fcb0c63 15.5 landed
- 924e0e2ee058 16.1 landed
- c6cf6d353c28 17.0 landed
-
Fix minmax-multi on infinite date/timestamp values
- 52c934cc1f2e 14.10 landed
- d04a9283b707 15.5 landed
- 497fc92086f8 16.1 landed
- 8da86d62a112 17.0 landed
-
Fix calculation in brin_minmax_multi_distance_date
- d1740e169d95 14.10 landed
- 088233f8db6c 15.5 landed
- e7965226d551 16.1 landed
- 394d51731495 17.0 landed
-
Fix overflow when calculating timestamp distance in BRIN
- 90c4da6d4392 14.10 landed
- daa7b0d7ce14 15.5 landed
- 0635fe02b426 16.1 landed
- b5489b75c6ce 17.0 landed