Re: BRIN minmax multi - incorrect distance for infinite timestamp/date
Tomas Vondra <tomas.vondra@enterprisedb.com>
From: Tomas Vondra <tomas.vondra@enterprisedb.com>
To: Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>,
Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Date: 2023-10-13T12:17:30Z
Lists: pgsql-hackers
On 10/13/23 14:04, Dean Rasheed wrote: > On Fri, 13 Oct 2023 at 11:44, Tomas Vondra > <tomas.vondra@enterprisedb.com> wrote: >> >> On 10/13/23 11:21, Dean Rasheed wrote: >>> >>> Is this only inefficient? Or can it also lead to wrong query results? >> >> I don't think it can produce incorrect results. It only affects which >> values we "merge" into an interval when building the summaries. >> > > Ah, I get it now. These "distance" support functions are only used to > see how far apart 2 ranges are, for the purposes of the algorithm that > merges the 2 closest ranges. So if it gets it wrong, it only leads to > a poor choice of ranges to merge, making the query inefficient, but > still correct. > Right. > Presumably, that also makes this kind of change safe to back-patch > (not sure if you were planning to do that?), since it will only affect > range merging choices when inserting new values into existing indexes. > I do plan to backpatch this, yes. I don't think there are many people affected by this (few people are using infinite dates/timestamps, but maybe the overflow could be more common). 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