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.

Suggestion?
--
Tatsuo Ishii
t-ishii@sra.co.jp


Wed, 17 Jun 1998 11:13:11 +0900
t-ishii@sra.co.jp
using a btree index in order by clause?
> 
> 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)

Wed, 17 Jun 1998 06:44:34 -0400 (EDT)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] using a btree index in order by clause?