From: | "Bryan White" <bryan(at)arcamax(dot)com> |
---|---|
To: | "pgsql" <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Controlling Reuslts with Limit |
Date: | 2001-02-23 21:24:14 |
Message-ID: | 00b801c09dde$f8cf2740$2dd260d1@arcamax.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
> Hi,
> I was reading through Bruce's on line . I found follwing bit unclear...
>
> "Notice that each query uses ORDER BY . Although this clause is not
required,
> LIMIT without ORDER BY returns random rows from the query, which would be
> useless. "
>
> When I run a query several time I get the same results as given
...
> I just want to know what exatly --"LIMIT without ORDER BY returns random
rows
> from the query" --means
I don't think it is actually random. It just that the order is not defined
and other events may change the order. I believe that without an ORDER BY
or other clauses that cause an index to be used that the database tends to
return rows in the order stored on disk. This order tends to be the order
in which rows were added. My observation is this ordering is faily stable
and it seems to survive a database reload. Just don't rely on it. There is
a CLUSTER command to change the physical ordering.
From | Date | Subject | |
---|---|---|---|
Next Message | Jie Liang | 2001-02-23 21:27:18 | Re: Controlling Reuslts with Limit |
Previous Message | Bruce Momjian | 2001-02-23 21:18:16 | Re: Controlling Reuslts with Limit |