Re: Yet another fast GiST build

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru>
Cc: Darafei Komяpa Praliaskouski <me(at)komzpa(dot)net>, Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Yet another fast GiST build
Date: 2020-09-15 17:07:38
Message-ID: 2a7fd6d6-01d7-5379-d957-02ce060e36a9@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 15/09/2020 19:46, Andrey M. Borodin wrote:
>
>
>> 15 сент. 2020 г., в 16:36, Heikki Linnakangas <hlinnaka(at)iki(dot)fi> написал(а):
>>
>> Another patch version, fixed a few small bugs pointed out by assertion failures in the regression tests.
>>
>> - Heikki
>> <v19-0001-Add-support-for-building-GiST-index-by-sorting.patch>
>
> These changes in create_index.out do not seem correct to me
>
> SELECT * FROM point_tbl ORDER BY f1 <-> '0,1';
> f1
> -------------------
> - (0,0)
> (1e-300,-1e-300)
> + (0,0)
>
> I did not figure out the root cause yet. We do not touch anything related to distance computation..

Ah yeah, that's subtle. Those rows are considered to be equally distant
from (0, 1), given the precision of the <-> operator:

regression=# SELECT f1, f1 <-> '0,1' FROM point_tbl ORDER BY f1 <-> '0,1';
f1 | ?column?
-------------------+------------------
(0,0) | 1
(1e-300,-1e-300) | 1
(-3,4) | 4.24264068711929
(-10,0) | 10.0498756211209
(10,10) | 13.4536240470737
(-5,-12) | 13.9283882771841
(5.1,34.5) | 33.885985303662
(1e+300,Infinity) | Infinity
(NaN,NaN) | NaN
|
(10 rows)

It is arbitrary which one you get first.

It's not very nice to have a not-well defined order of rows in the
expected output, as it could change in the future if we change the index
build algorithm again. But we have plenty of cases that depend on the
physical row order, and it's not like this changes very often, so I
think it's ok to just memorize the new order in the expected output.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-09-15 17:41:02 Re: pg_restore causing deadlocks on partitioned tables
Previous Message Tom Lane 2020-09-15 17:05:59 Re: PG 13 release notes, first draft