| От | Joseph Shraibman |
|---|---|
| Тема | Re: selecting random rows |
| Дата | |
| Msg-id | 3F6114F9.4010104@selectacast.net обсуждение исходный текст |
| Ответ на | Re: selecting random rows (Dennis Gearon <gearond@fireserve.net>) |
| Ответы |
Re: selecting random rows
|
| Список | pgsql-general |
Dennis Gearon wrote: > If you have a nice small Primary key on the table, you can so something > like this: > > SELECT field_list > FROM table > WHERE primary_key IN( > SELECT primary_key, > FROM table > ORDER by RANDOM() > LIMIT your_limit); > > This may not be the exact sequence, and there is some workarounds for > some slowness in the IN() keyword. Others may comment at will, and > polish this up? > What exactly does that do for me? Postgres still has to go over the whole table to get the primary keys.
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера