Re: sorting problem

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, Bruno Wolff III <bruno(at)wolff(dot)to>, pgsql-general(at)postgresql(dot)org
Subject: Re: sorting problem
Date: 2004-12-17 20:36:58
Message-ID: 87u0qkirv9.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> Greg Stark <gsstark(at)mit(dot)edu> writes:
> > Bruno Wolff III <bruno(at)wolff(dot)to> writes:
> >> Using an index to do an order by is an order N operation.
>
> > No, using an index to do an order by is actually still n*log(n). You have to
> > traverse all the parent pages in the binary tree of the index as well.
>
> Only if you searched afresh from the root for each key, which an
> indexscan is not going to do.

Isn't that still nlog(n)? In the end you're going to have read in every page
of the index including all those non-leaf pages. Aren't there nlog(n) pages?

--
greg

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jerry LeVan 2004-12-17 20:41:26 OSX 10.3.7 broke Postgresql 8.0.0b5?
Previous Message Lincoln Yeoh 2004-12-17 20:09:52 Re: sorting problem