Re: [SQL] Controlling Reuslts with Limit

2001-02-23 Thread Stephan Szabo
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

Re: [SQL] Controlling Reuslts with Limit

2001-02-23 Thread Tom Lane
Najm Hashmi <[EMAIL PROTECTED]> writes: > I just want to know what exatly --"LIMIT without ORDER BY returns random rows > from the query" --means It means the results aren't guaranteed. It doesn't mean that the exact same query run under the exact same conditions by the exact same version of Po

Re: [SQL] Controlling Reuslts with Limit

2001-02-23 Thread Bruce Momjian
> 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

Re: [SQL] Controlling Reuslts with Limit

2001-02-23 Thread Jie Liang
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. Bern

Re: [SQL] Controlling Reuslts with Limit

2001-02-23 Thread Bryan White
> 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 t

Re: [SQL] Controlling Reuslts with Limit

2001-02-23 Thread Bruce Momjian
> 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. " It means there is no guarantee which rows wi