Re: multi-column btree index for real values - Mailing list pgsql-general

From Martin Weinberg
Subject Re: multi-column btree index for real values
Date
Msg-id 200210051536.g95FalvH017012@osprey.astro.umass.edu
Whole thread Raw
In response to Re: multi-column btree index for real values  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: multi-column btree index for real values  (Bruce Momjian <pgman@candle.pha.pa.us>)
List 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@svana.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.
>

pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: multi-column btree index for real values
Next
From: Tom Lane
Date:
Subject: Re: Boolean output format