Re: Proposal to introduce a shuffle function to intarray extension
Mladen Gogala <gogala.mladen@gmail.com>
From: Mladen Gogala <gogala.mladen@gmail.com>
To: pgsql-general@lists.postgresql.org
Date: 2022-07-16T16:53:49Z
Lists: pgsql-hackers, pgsql-general
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
Commits
-
Add array_sample() and array_shuffle() functions.
- 888f2ea0a81f 16.0 landed
-
Use a separate random seed for SQL random()/setseed() functions.
- 6645ad6bdd81 12.0 cited