Re: Questions about support function and abbreviate

From: Han Wang <hanwgeek(at)gmail(dot)com>
To: Darafei Komяpa Praliaskouski <me(at)komzpa(dot)net>
Cc: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Questions about support function and abbreviate
Date: 2021-06-12 07:42:30
Message-ID: CADCmNp1dYmPq9rcy5ujx+3zH51d7uCX5iR+5jAJfyhr4pe97BA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Darafei,

Thanks for your reply.

However, I still don't get the full picture of this. Let me make my
question more clear.

First of all, in the *`gistproc.c
<https://github.com/postgres/postgres/blob/master/src/backend/access/gist/gistproc.c#L1761>`*
of Postgres, it shows that the `abbreviate` attributes should be set before
the `abbrev_converter` defined. So I would like to know where to define a
`SortSupport` structure with `abbreviate` is `true`.

Secondly, in the support functions of internal data type `Point`, the
`abbrev_full_copmarator` just z-order hash the point first like the
`abbrev_converter` doing and then compare the hash value. So I don't know
the difference between `full_comparator` and `comparator` after
`abbrev_converter`.

Best regards,
Han

On Sat, Jun 12, 2021 at 2:55 PM Darafei "Komяpa" Praliaskouski <
me(at)komzpa(dot)net> wrote:

> Hello,
>
> the abbrev_converter is applied whenever it is defined. The values are
> sorted using the abbreviated comparator first using the shortened version,
> and if there is a tie the system asks the real full comparator to resolve
> it.
>
> This article seems to be rather comprehensive:
> https://brandur.org/sortsupport
>
> On Sat, Jun 12, 2021 at 9:51 AM Han Wang <hanwgeek(at)gmail(dot)com> wrote:
>
>> Hi all,
>>
>> I am trying to implement a sort support function for geometry data types
>> in PostGIS with the new feature `SortSupport`. However, I have a question
>> about this.
>>
>> I think it is hardly to apply a sort support function to a complex data
>> type without the `abbrev_converter` to simply the data structure into a
>> single `Datum`. However, I do not know how the system determines when to
>> apply the converter.
>>
>> I appreciate any answers or suggestions. I am looking forward to hearing
>> from you.
>>
>> Best regards,
>> Han
>>
>
>
> --
> Darafei "Komяpa" Praliaskouski
> OSM BY Team - http://openstreetmap.by/
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2021-06-12 07:43:20 Failure in subscription test 004_sync.pl
Previous Message Amit Kapila 2021-06-12 07:22:23 Re: Decoding of two-phase xacts missing from CREATE_REPLICATION_SLOT command