Re: Inserting Multiple Random Rows

Поиск
Список
Период
Сортировка
От Gary Chambers
Тема Re: Inserting Multiple Random Rows
Дата
Msg-id w2q302670f21004281219ue31d0e61xe3a76d0e2a49b5be@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Inserting Multiple Random Rows  (Justin Graf <justin@magwerks.com>)
Список pgsql-sql
Justin,

Thanks for the reply!

> you need to generate a series of random numbers then select each record
> one at a time out of cities table .  You will have to write a plsql
> function to do this As any join will cause the result to be ordered.

After modifying my search terms at Google, I've discovered that I'm
not alone in this endeavor.  There are a couple of informative
articles, the most beneficial of which is written by depesz at
http://www.depesz.com/index.php/2007/09/16/my-thoughts-on-getting-random-row/
and the one that referred me to it at
http://blog.rhodiumtoad.org.uk/2009/03/08/selecting-random-rows-from-a-table/

> Here is example of pl-sql procedure that inserts records randomly into a
> table from a another table.

I could have been done with this in pretty short order if I had just
continued with writing a quick PL/pgSQL function to do it.  It's all
Quassnoi's fault that I abandoned my original plan and tried to solve
the problem with a query.  After all, I need to learn to think in sets
and get out of the procedural mindset, but I still haven't heard the
click! :)

Thanks for the suggestion in your follow-up e-mail.  I'll post the
solution upon discovering it.

-- Gary Chambers

/* Nothing fancy and nothing Microsoft! */


В списке pgsql-sql по дате отправления:

Предыдущее
От: Justin Graf
Дата:
Сообщение: Re: Inserting Multiple Random Rows
Следующее
От: Gary Chambers
Дата:
Сообщение: Re: Inserting Multiple Random Rows