Re: About sorting rows randomly
От | Tim Ellis |
---|---|
Тема | Re: About sorting rows randomly |
Дата | |
Msg-id | 1048847388.2338.6.camel@timetop обсуждение исходный текст |
Ответ на | About sorting rows randomly ("Marc Soler" <msoler@el-valles.com>) |
Ответы |
Requests per second ?
|
Список | pgsql-admin |
On Fri, 2003-03-28 at 00:32, Marc Soler wrote: > It's possible to return rows randomly sorted? > Something like this: > Select * from table order by random The way I've accomplished this in the past is to create an extra column, call it "randNum," populate it with random numbers, then order by that column. If you don't care how strong the "randomness" is, you can sort by an arbitrary column that has a lot of variation, say a foreign key column ID. I've also seen the logic moved into the application: select the values into an array, and randomly traverse the array. -- Tim Ellis Senior Database Architect and author, tedia2sql (http://tedia2sql.tigris.org) If this helped you, http://svcs.affero.net/rm.php?r=philovivero
В списке pgsql-admin по дате отправления: