Re: Controlling Reuslts with Limit

Поиск
Список
Период
Сортировка
От Jie Liang
Тема Re: Controlling Reuslts with Limit
Дата
Msg-id Pine.BSF.4.10.10102231320250.58909-100000@tidal.ipinc.com
обсуждение исходный текст
Ответ на Controlling Reuslts with Limit  (Najm Hashmi <najm@mondo-live.com>)
Список pgsql-sql
My understanding:
because you return a subset instead of a single value,
so between 2 select ... limit ... queries.
if you delete a record(say song_id=947) then insert it again.
then results are different.
So for a multiple users db, you should use oder by when you use limit.


Jie LIANG

St. Bernard Software
Internet Products Inc.

10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873

jliang@ipinc.com
www.stbernard.com
www.ipinc.com

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)
> 
> flipr=# select song_id from songs  limit 5;
>  song_id
> ---------
>      945
>      946
>      947
>      948
>      949
> (5 rows)
> 
> flipr=# select song_id from songs  limit 5;
>  song_id
> ---------
>      945
>      946
>      947
>      948
>      949
> (5 rows)
> 
> flipr=# select song_id from songs  limit 5;
>  song_id
> ---------
>      945
>      946
>      947
>      948
>      949
> (5 rows)
> 
> flipr=# select song_id from songs  limit 5;
>  song_id
> ---------
>      945
>      946
>      947
>      948
>      949
> (5 rows)
> 
> flipr=# select song_id from songs  limit 5;
>  song_id
> ---------
>      945
>      946
>      947
>      948
>      949
>  I just want to know what exatly --"LIMIT without ORDER BY returns random rows
> from the query" --means
> Regards
> 



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

Предыдущее
От: "Bryan White"
Дата:
Сообщение: Re: Controlling Reuslts with Limit
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Controlling Reuslts with Limit