Re: AW: Implicit order-by in Postgresql? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: AW: Implicit order-by in Postgresql?
Date
Msg-id 8456.992353137@sss.pgh.pa.us
Whole thread Raw
In response to AW: Implicit order-by in Postgresql?  (Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at>)
List pgsql-hackers
Zeugswetter Andreas SB  <ZeugswetterA@wien.spardat.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


pgsql-hackers by date:

Previous
From: Darren Johnson
Date:
Subject: Re: AW: Postgres Replication
Next
From: Alex Pilosov
Date:
Subject: inet/cidr wierdness (casting)