Re: R-Trees in PostgreSQL - Mailing list pgsql-general

From Greg Stark
Subject Re: R-Trees in PostgreSQL
Date
Msg-id 407d949e0911022010n23e8e73cx95f6edb6d207bb59@mail.gmail.com
Whole thread Raw
In response to Re: R-Trees in PostgreSQL  (Jeff Davis <pgsql@j-davis.com>)
Responses Re: R-Trees in PostgreSQL  (Sam Mason <sam@samason.me.uk>)
List pgsql-general
On Mon, Nov 2, 2009 at 4:41 PM, Jeff Davis <pgsql@j-davis.com> wrote:
> On Tue, 2009-11-03 at 00:25 +0100, Viktor Rosenfeld wrote:
>> I'd like to know what kind of functions I have to implement for a R-Tree
>> index on numeric columns,
>
> NUMERIC is scalar, so an R-Tree doesn't make much sense. You can install
> btree_gist (a contrib module) to be able to use numeric columns as part
> of a GiST index.

It sounds like what you're trying to do needs an "expression index" so
you can construct a data type which does support gist indexes out of
your two numeric columns. You could do something like create index i
on (point(col1,col2)) though I think you might have to actually make a
"box" instead. Alternatively you could look at the "cube" contrib
module. As far as i know all of these actually work with doubles
though, so you'll lose precision.

--
greg

pgsql-general by date:

Previous
From: Craig Ringer
Date:
Subject: Re: 8.4 initdb failure
Next
From: Sam Mason
Date:
Subject: Re: R-Trees in PostgreSQL