Re: [HACKERS] using a btree index in order by clause?

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: t-ishii(at)sra(dot)co(dot)jp
Cc: pgsql-hackers(at)hub(dot)org
Subject: Re: [HACKERS] using a btree index in order by clause?
Date: 1998-06-17 10:44:34
Message-ID: 199806171044.GAA18849@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)candle(dot)pha(dot)pa(dot)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)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jose' Soares Da Silva 1998-06-17 12:03:43 Re: [GENERAL] COALESCE() or NVL()
Previous Message t-ishii 1998-06-17 08:18:52 Re: AW: [HACKERS] using a btree index in order by clause?