Re: Sort functions with specialized comparators - Mailing list pgsql-hackers

From John Naylor
Subject Re: Sort functions with specialized comparators
Date
Msg-id CANWCAZZ4VqPFwSpS=7UOROzexyiQH4JSwJ+1Gfpj5wDw_WUOMA@mail.gmail.com
Whole thread Raw
In response to Re: Sort functions with specialized comparators  ("Andrey M. Borodin" <x4mmm@yandex-team.ru>)
List pgsql-hackers
On Mon, Dec 16, 2024 at 12:58 AM Andrey M. Borodin <x4mmm@yandex-team.ru> wrote:
>
> > On 11 Dec 2024, at 11:39, John Naylor <johncnaylorls@gmail.com> wrote:

> > Also, I was hoping get an answer for how this would actually affect
> > intarray use you've seen in the wild. If the answer is "I don't know
> > of any one who uses this either", then I'm actually starting to wonder
> > if the speed matters at all. Maybe all uses are for a few hundred or
> > thousand integers, in which case the sort time is trivial anyway?
>
> I do not have access to user data in most clusters... I remember only one particular case: tags and folders applied
tomail messages are represented by int array. Mostly for GIN search. In that case vast majority of these arrays are
0-10elements, some hot-acceses fraction of 10-1000. Only robots (service accounts) can have millions, and in their case
latencyhave no impact at all. 
> But this particular case also does not trigger sorting much: arrays are stored sorted and modifications are
infrequent.In most cases sorting is invoked for already sorted or almost sorted input. 

Okay, if one case uses millions, than surely others also do so.

> So yeah, from practical point of view cosmetic reasons seems to be most important :)

Seems worth doing.

--
John Naylor
Amazon Web Services



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: pure parsers and reentrant scanners
Next
From: John Naylor
Date:
Subject: Re: Sort functions with specialized comparators