Re: sorting problem - Mailing list pgsql-general

From Tom Lane
Subject Re: sorting problem
Date
Msg-id 24083.1103318166@sss.pgh.pa.us
Whole thread Raw
In response to Re: sorting problem  (Bruno Wolff III <bruno@wolff.to>)
List pgsql-general
Bruno Wolff III <bruno@wolff.to> writes:
> Greg Stark <gsstark@mit.edu> wrote:
>> 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?

> The depth of the tree is log N, but there are only N nodes. I think you
> can treat the amount of information at each node as constant.

Besides, we don't read any non-leaf pages except the ones down the left
edge of the btree.  An indexscan just visits the leaf pages using their
sibling links to get from one to the next.  (If it did otherwise, we'd
not produce the output in sorted order, which would make this discussion
moot...)

            regards, tom lane

pgsql-general by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: replacements for vacuum?
Next
From: Tom Lane
Date:
Subject: Re: replacements for vacuum?