Re: limitby without orderby - Mailing list pgsql-general

From Albe Laurenz
Subject Re: limitby without orderby
Date
Msg-id D960CB61B694CF459DCFB4B0128514C2049FCE76@exadv11.host.magwien.gv.at
Whole thread Raw
In response to limitby without orderby  (Rohan Malhotra <yourbuddyrohan@gmail.com>)
List pgsql-general
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

pgsql-general by date:

Previous
From: "Albe Laurenz"
Date:
Subject: Re: why VOLATILE attribute is required?
Next
From: Eric Ridge
Date:
Subject: OS X 10.7, psql, and tab completion?