Re: [HACKERS] using a btree index in order by clause? - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] using a btree index in order by clause?
Date
Msg-id 199806171044.GAA18849@candle.pha.pa.us
Whole thread Raw
In response to using a btree index in order by clause?  (t-ishii@sra.co.jp)
List pgsql-hackers
>
> Hi,
>
> I'm wondering if we can use btree index to sort the results in a
> certain condition. The idea is, if the order-items in the order by
> clause have a btree index, then why we need to sort them again?
>
> I'm starting to look at the executor code. However this kind of
> "optimization" might be better to be done in the optimizer, I don't
> know.

FYI, often, using an index to sort a tables is SLOWER than loading all the
rows into psort and sorting them, because the index causes random seeks
all over the table.

--
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)

pgsql-hackers by date:

Previous
From: "Jose' Soares Da Silva"
Date:
Subject: Re: [GENERAL] COALESCE() or NVL()
Next
From: infotechsys@pivot.net
Date:
Subject: http://www.postgresql.org/devel-mlists.shtml