Re: sorting problem - Mailing list pgsql-general

From Greg Stark
Subject Re: sorting problem
Date
Msg-id 87mzwckfyp.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: sorting problem  (Bruno Wolff III <bruno@wolff.to>)
Responses Re: sorting problem
List pgsql-general
Bruno Wolff III <bruno@wolff.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.

This only goes to show how small the log(n) component of the order is. It's
easily dwarfed by large constants such as the difference in i/o efficiency
from non-contiguous reads.

--
greg

pgsql-general by date:

Previous
From: Greg Stark
Date:
Subject: Re: Scheduler in Postgres
Next
From: Tom Lane
Date:
Subject: Re: sorting problem