Re: Controlling Reuslts with Limit - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: Controlling Reuslts with Limit
Date
Msg-id Pine.BSF.4.21.0102231338500.18764-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Controlling Reuslts with Limit  (Najm Hashmi <najm@mondo-live.com>)
List 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 by date:

Previous
From: Tom Lane
Date:
Subject: Re: Controlling Reuslts with Limit
Next
From: Stephan Richter
Date:
Subject: Recursive Query (need of PL/pgSQL?)