Re: BRIN minmax multi - incorrect distance for infinite timestamp/date

From: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Subject: Re: BRIN minmax multi - incorrect distance for infinite timestamp/date
Date: 2023-10-13 12:17:30
Message-ID: 75de1895-3bd9-242e-cf13-3f5b0281e676@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10/13/23 14:04, Dean Rasheed wrote:
> On Fri, 13 Oct 2023 at 11:44, Tomas Vondra
> <tomas(dot)vondra(at)enterprisedb(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2023-10-13 12:20:52 Re: [RFC] Add jit deform_counter
Previous Message Dean Rasheed 2023-10-13 12:04:02 Re: BRIN minmax multi - incorrect distance for infinite timestamp/date