Received: from candle.pha.pa.us (candle.navpoint.com [162.33.245.46] (may be forged)) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f1NM0Yx12488 for ; Fri, 23 Feb 2001 17:00:34 -0500 (EST) (envelope-from pgman@candle.pha.pa.us) Received: (from pgman@localhost) by candle.pha.pa.us (8.9.0/8.9.0) id QAA00396; Fri, 23 Feb 2001 16:59:09 -0500 (EST) From: Bruce Momjian Message-Id: <200102232159.QAA00396@candle.pha.pa.us> Subject: Re: Controlling Reuslts with Limit In-Reply-To: <00b801c09dde$f8cf2740$2dd260d1@arcamax.com> "from Bryan White at Feb 23, 2001 04:24:14 pm" To: Bryan White Date: Fri, 23 Feb 2001 16:59:09 -0500 (EST) CC: pgsql X-Mailer: ELM [version 2.4ME+ PL77 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Archive-Number: 200102/370 X-Sequence-Number: 1569 > 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@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026