From: | Mladen Gogala <gogala(dot)mladen(at)gmail(dot)com> |
---|---|
To: | Martin Kalcher <martin(dot)kalcher(at)aboutsource(dot)net>, pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Proposal to introduce a shuffle function to intarray extension |
Date: | 2022-07-16 21:30:08 |
Message-ID: | 1351c57e-4a5d-4554-8b15-1264ce0cb39a@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
On 7/16/22 16:21, Martin Kalcher wrote:
> Hey Mladen,
>
> thank you for your advice. Unfortunately the performance of shuffling
> with NumPy is about the same as with SQL.
>
> create function numpy_shuffle(arr int[])
> returns int[]
> as $$
> import numpy
> numpy.random.shuffle(arr)
> return arr
> $$ language 'plpython3u';
>
> select arr[1:3]::text || ' ... ' || arr[3999998:4000000]::text
> from (
> select numpy_shuffle(arr) arr from numbers
> ) shuffled;
>
> -------------------------------------------------------
> {674026,3306457,1727170} ... {343875,3825484,1235246}
>
> Time: 2315.431 ms (00:02.315)
>
> Am i doing something wrong?
>
> Martin
Hi Martin,
No, you're doing everything right. I have no solution for you. You may
need to do some C programming or throw a stronger hardware at the
problem. The performance of your processors may be the problem. Good luck!
--
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
https://dbwhisperer.wordpress.com
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Munro | 2022-07-16 21:56:27 | Re: Proposal to introduce a shuffle function to intarray extension |
Previous Message | Martin Kalcher | 2022-07-16 20:21:54 | Re: Proposal to introduce a shuffle function to intarray extension |
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Munro | 2022-07-16 21:56:27 | Re: Proposal to introduce a shuffle function to intarray extension |
Previous Message | Nathan Bossart | 2022-07-16 20:30:34 | Re: remove reset_shared() |