Re: array_random
От | jian he |
---|---|
Тема | Re: array_random |
Дата | |
Msg-id | CACJufxHyCEnikLTamm2UaxQKfuzeE=qvyQXxSRLwA-u-QZnjJg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: array_random (Dean Rasheed <dean.a.rasheed@gmail.com>) |
Ответы |
Re: array_random
|
Список | pgsql-hackers |
On Fri, Jul 11, 2025 at 3:49 PM Dean Rasheed <dean.a.rasheed@gmail.com> wrote: > > On Tue, 8 Jul 2025 at 15:26, Aleksander Alekseev > <aleksander@tigerdata.com> wrote: > > > > The proposed function seems to do two things at a time - generating > > random values and transforming them into an array of desired > > dimensions. Generally we try to avoid such interfaces. Can you think > > of something like array_transform() / array_reshape() that takes an > > arbitrary single-dimension array and modifies it? > > That's a good point. Arguably, creating a simple 1-D array of random > values is trivial enough to leave to users, and there isn't sufficient > demand to justify creating core functions for it. > use sql, we generally do something like: select array_agg(random(1, 10)) from generate_series(1, 2) g; but its performance is worse than array_random. Does performance and other factors justify adding array_random?
В списке pgsql-hackers по дате отправления: