Search Postgresql Archives

Re: limitby without orderby

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rohan Malhotra wrote:
> What is difference between 
>

> select * from items order by random() limit 5;
>

> and 
>

> select * items limit 5;
>

> my basic requirement is to get random rows from a table, my where clause will make sure I won't get
> same rows in repeated execution of above queries.
 
The second query will not return the rows in a randomized order, but rather
in the order they are found. You should use the first query.

Yours,
Laurenz Albe

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux