Re: Sort functions with specialized comparators

From: John Naylor <johncnaylorls(at)gmail(dot)com>
To: "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, Антуан Виолин <violin(dot)antuan(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Sort functions with specialized comparators
Date: 2024-12-16 09:01:01
Message-ID: CANWCAZZ4VqPFwSpS=7UOROzexyiQH4JSwJ+1Gfpj5wDw_WUOMA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Dec 16, 2024 at 12:58 AM Andrey M. Borodin <x4mmm(at)yandex-team(dot)ru> wrote:
>
> > On 11 Dec 2024, at 11:39, John Naylor <johncnaylorls(at)gmail(dot)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 to mail messages are represented by int array. Mostly for GIN search. In that case vast majority of these arrays are 0-10 elements, some hot-acceses fraction of 10-1000. Only robots (service accounts) can have millions, and in their case latency have 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2024-12-16 09:02:19 Re: Sort functions with specialized comparators
Previous Message Heikki Linnakangas 2024-12-16 08:40:57 Re: pure parsers and reentrant scanners