Re: Controlling Reuslts with Limit
От | Bryan White |
---|---|
Тема | Re: Controlling Reuslts with Limit |
Дата | |
Msg-id | 00b801c09dde$f8cf2740$2dd260d1@arcamax.com обсуждение исходный текст |
Ответ на | Controlling Reuslts with Limit (Najm Hashmi <najm@mondo-live.com>) |
Ответы |
Re: Controlling Reuslts with Limit
|
Список | 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.
В списке pgsql-sql по дате отправления: