AW: Implicit order-by in Postgresql?

From: Zeugswetter Andreas SB <ZeugswetterA(at)wien(dot)spardat(dot)at>
To: "'earthlink'" <NOSPAMnews(at)tinyvital(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: AW: Implicit order-by in Postgresql?
Date: 2001-06-12 07:35:03
Message-ID: 11C1E6749A55D411A9670001FA68796336831C@sdexcsrv1.f000.d0188.sd.spardat.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> Frequently one wants a data set returned in the same order as the
> index used in the query. Informix (at least) has implicit order-by,
> which means that the data will be returned in collating order if the
> query forces use of the appropriate index.
>
> Does Postgresql do this?

Yes, but same as in Informix you can not rely on the optimizer to choose
that plan, if he thinks another access is cheaper. (In Informix you can
force a certain index with an optimizer directive which is not available
in PostgreSQL, but for this particular case simply use an order by in both
databases)

> If not, does an Order-by force a sort even if an index has the correct
> order to satisfy the order-by?

If a btree index is chosen that satisfies the order by, the sort is
avoided.

Andreas

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message The Hermit Hacker 2001-06-12 09:07:41 Re: AW: Postgres Replication
Previous Message root 2001-06-12 07:06:23 Re: AW: Postgres Replication