Обсуждение: Rows ordered

Поиск
Список
Период
Сортировка

Rows ordered

От
camilarrocha@hotmail.com (Camila Rocha)
Дата:
Hi again..

I have another problem: I want to keep the rows in a table ordered. Is
there some structure in postgresql that can help me??

Thanks,

Camila

Re: Rows ordered

От
Alvaro Herrera
Дата:
On Thu, Oct 03, 2002 at 05:34:29AM -0700, Camila Rocha wrote:

> I have another problem: I want to keep the rows in a table ordered. Is
> there some structure in postgresql that can help me??

You should be using ORDER BY in your SELECT's if you want any ordering.

That said, the CLUSTER command can be used to order the rows physically
within the table following some index.  Read its documentation before
using it, it can be dangerous to your schema!!

--
Alvaro Herrera (<alvherre[a]atentus.com>)
"La victoria es para quien se atreve a estar solo"

Re: Rows ordered

От
Bruce Momjian
Дата:
Camila Rocha wrote:
> Hi again..
>
> I have another problem: I want to keep the rows in a table ordered. Is
> there some structure in postgresql that can help me??

No, there is no fixed ordering of tables in SQL.  You can create a VIEW
and place an ORDER BY in there, I think. If you want them physically
ordered, use CLUSTER.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073