Re: Proposal to introduce a shuffle function to intarray extension

From: Mladen Gogala <gogala(dot)mladen(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Proposal to introduce a shuffle function to intarray extension
Date: 2022-07-16 16:53:49
Message-ID: b1715621-8d89-cddf-e488-bc140b6028c7@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On 7/15/22 04:36, Martin Kalcher wrote:
> Dear list,
>
> i am dealing with an application that processes fairly large arrays of
> integers. It makes heavy use of the intarray extension, which works
> great in most cases. However, there are two requirements that cannot
> be addressed by the extension and are rather slow with plain SQL. Both
> can be met with shuffling:
>
> - Taking n random members from an integer array
> - Splitting an array into n chunks, where each member is assigned to a
> random chunk
>
> Shuffling is currently implemented by unnesting the array, ordering
> the members by random() and aggregating them again.

Martin, have you considered PL/Python and NumPy module?

--
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
https://dbwhisperer.wordpress.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Lucie Šimečková 2022-07-16 17:24:56 Proposed Translations of Updated Code of Conduct Policy
Previous Message Adrian Klaver 2022-07-16 15:30:29 Re: equivalent thing of mtr in mysql

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-07-16 17:09:12 Re: The "char" type versus non-ASCII characters
Previous Message Nikolay Shaplov 2022-07-16 16:43:07 Re: The "char" type versus non-ASCII characters