Re: Controlling Reuslts with Limit

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Bryan White <bryan(at)arcamax(dot)com>
Cc: pgsql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Controlling Reuslts with Limit
Date: 2001-02-23 21:59:09
Message-ID: 200102232159.QAA00396@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> 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.

Yes, usually it is the heap order, but if you do "col > 12" you may get
it in index order by the column indexes, or you may not, depending on
the constant, the size of the table, vacuum, vacuum analyze, etc.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Richter 2001-02-23 22:40:08 Recursive Query (need of PL/pgSQL?)
Previous Message Stephan Szabo 2001-02-23 21:46:50 Re: Controlling Reuslts with Limit