Re: multi-column btree index for real values

From: Martin Weinberg <weinberg(at)osprey(dot)astro(dot)umass(dot)edu>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: "Martin D(dot) Weinberg" <weinberg(at)astro(dot)umass(dot)edu>, pgsql-general(at)postgresql(dot)org
Subject: Re: multi-column btree index for real values
Date: 2002-10-05 15:36:47
Message-ID: 200210051536.g95FalvH017012@osprey.astro.umass.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Martijn,

Thanks. So that implies that a multidimensional btree index is
useless for two columns of floats (one will probably always
be searching on the first index for a tree of large height).

Let me restate my question as an example. Supose I have columns
of longitude and latitude. What is the best indexing strategy to
find all tuples with in a two dimensional bound of longitude and
latitude. E.g. with where clause

lat between 21.49 and 37.41 and
lon between 70.34 and 75.72
--Martin

Martijn van Oosterhout wrote on
Sun, 06 Oct 2002 00:02:58 +1000
>On Thu, Oct 03, 2002 at 02:00:30PM -0400, Martin D. Weinberg wrote:
>> Folks,
>>
>> Can someone quickly describe how the btree is implemented for multiple
>> columns? In particular, under what (if any) circumstances is there an
>> advantage if the index is over floating point values?
>
>AFAIK, multi-column btrees and simply handled by building a btree of the
>first column. Each leaf contains a reference to another btree for the second
>column, etc...
>
>btrees are useful for < and > comparisons, meaning that queries saying WHERE
>x BETWEEN 1.0 and 1.5 can use the index.
>--
>Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
>> There are 10 kinds of people in the world, those that can do binary
>> arithmetic and those that can't.
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-10-05 15:59:44 Re: Boolean output format
Previous Message Baurjan Ismagulov 2002-10-05 15:12:47 Re: SERIAL with TTable in cbuilder