pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mladen Gogala <gogala.mladen@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Proposal to introduce a shuffle function to intarray extension
Date: Sat, 16 Jul 2022 12:53:49 -0400
Message-ID: <b1715621-8d89-cddf-e488-bc140b6028c7@gmail.com> (raw)
In-Reply-To: <9d160a44-7675-51e8-60cf-6d64b76db831@aboutsource.net>
References: <9d160a44-7675-51e8-60cf-6d64b76db831@aboutsource.net>

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

view thread (25+ messages)  latest in thread

Message-ID: <b1715621-8d89-cddf-e488-bc140b6028c7@gmail.com>
Permalink:  ../b1715621-8d89-cddf-e488-bc140b6028c7@gmail.com/
Also on:    postgresql.org/message-id/b1715621-8d89-cddf-e488-bc140b6028c7@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: gogala.mladen@gmail.com
  Subject: Re: Proposal to introduce a shuffle function to intarray extension
  In-Reply-To: <b1715621-8d89-cddf-e488-bc140b6028c7@gmail.com>
  References: <9d160a44-7675-51e8-60cf-6d64b76db831@aboutsource.net> <b1715621-8d89-cddf-e488-bc140b6028c7@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox