Re: Controlling Reuslts with Limit

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Controlling Reuslts with Limit
Дата
Msg-id Pine.BSF.4.21.0102231338500.18764-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на Controlling Reuslts with Limit  (Najm Hashmi <najm@mondo-live.com>)
Список pgsql-sql
It returns the first five rows it finds.  Running the same
query over again if there are no updates is safe, but if the
table is updated there is the possibility it would find a different
five rows.  If the query would do a seq scan and you updated
a row, the rows would be in a different order in the heap file and so
you'd get a different ordering of rows...

On Sat, 24 Feb 2001, Najm Hashmi wrote:

> 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
> flipr=# select song_id from songs  limit 5;
>  song_id
> ---------
>      945
>      946
>      947
>      948
>      949
> (5 rows)
> ...




В списке pgsql-sql по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Controlling Reuslts with Limit
Следующее
От: Stephan Richter
Дата:
Сообщение: Recursive Query (need of PL/pgSQL?)