pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@enterprisedb.com>
To: Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Subject: Re: BRIN minmax multi - incorrect distance for infinite timestamp/date
Date: Fri, 13 Oct 2023 14:17:30 +0200
Message-ID: <75de1895-3bd9-242e-cf13-3f5b0281e676@enterprisedb.com> (raw)
In-Reply-To: <CAEZATCUNjgmTfTJnkR+DMXfRbrm+bqJuEZ-fKRJF3X4mr=o3LQ@mail.gmail.com>
References: <eef0ea8c-4aaa-8d0d-027f-58b1f35dd170@enterprisedb.com>
	<CAEZATCWwqTdcBC1ee1uLp+KG4XZLmxFwEGX9y9sBLUR+OdQHeA@mail.gmail.com>
	<14c205c6-fbf4-d2f2-3ea8-a7d5c5d63180@enterprisedb.com>
	<CAEZATCUNjgmTfTJnkR+DMXfRbrm+bqJuEZ-fKRJF3X4mr=o3LQ@mail.gmail.com>

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





view thread (27+ messages)  latest in thread

Message-ID: <75de1895-3bd9-242e-cf13-3f5b0281e676@enterprisedb.com>
Permalink:  ../75de1895-3bd9-242e-cf13-3f5b0281e676@enterprisedb.com/
Also on:    postgresql.org/message-id/75de1895-3bd9-242e-cf13-3f5b0281e676@enterprisedb.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tomas.vondra@enterprisedb.com, dean.a.rasheed@gmail.com, pgsql-hackers@lists.postgresql.org, ashutosh.bapat.oss@gmail.com
  Subject: Re: BRIN minmax multi - incorrect distance for infinite timestamp/date
  In-Reply-To: <75de1895-3bd9-242e-cf13-3f5b0281e676@enterprisedb.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox