Re: AW: Implicit order-by in Postgresql?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Zeugswetter Andreas SB <ZeugswetterA(at)wien(dot)spardat(dot)at>
Cc: "'earthlink'" <NOSPAMnews(at)tinyvital(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: AW: Implicit order-by in Postgresql?
Date: 2001-06-12 13:38:57
Message-ID: 8456.992353137@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Zeugswetter Andreas SB <ZeugswetterA(at)wien(dot)spardat(dot)at> writes:
>> 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.

And, of course, selection of that index is encouraged, because the
optimizer will realize that any other plan will require an explicit
sort step with extra costs.

Bottom line: say what you mean, don't try to outsmart the system.
If you want your results delivered in order, say ORDER BY.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zeugswetter Andreas SB 2001-06-12 13:50:09 AW: AW: Postgres Replication
Previous Message Darren Johnson 2001-06-12 13:32:16 Re: AW: Postgres Replication