Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-hackers by date

Next:From: infotechsysDate: 1998-06-17 11:22:04
Subject: http://www.postgresql.org/devel-mlists.shtml
Previous:From: t-ishiiDate: 1998-06-17 08:18:52
Subject: Re: AW: [HACKERS] using a btree index in order by clause?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group