Re: several questions about R-tree index - Mailing list pgsql-sql

From Andrew - Supernews
Subject Re: several questions about R-tree index
Date
Msg-id slrnd6tnq8.fpt.andrew+nonews@trinity.supernews.net
Whole thread Raw
In response to several questions about R-tree index  ("TJ O'Donnell" <tjo@acm.org>)
List pgsql-sql
On 2005-04-26, "TJ O'Donnell" <tjo@acm.org> wrote:
> But I think I might be able to do better (faster) using R-trees.
> Bitstrings can be thought of as "containing" when one bitstring has all the
> same bits set as another, even if it has other bits set too - this is the
> gist of the first where-clause above.
>
> Can I expect to be able to use R-tree's to do this?

You may want to use GIST instead - it is more flexible.

> Will I simply have to define a new datatype and three R-tree functions
> (union, intersection and size).
> Will the use of the ~ (contains) operator cause the planner to consider
> using an index (this is my first question, way above)?

What the planner actually looks for is, having identified the specific
operator and types, whether an index opclass exists for them, and if so
whether an index using that opclass exists. The actual names of the
operators are irrelevent.

So for either rtree or GIST, all you need is to define your new datatype,
with its associated operators, and create an operator class for it with
appropriate support functions, and create indexes using that opclass.
Once all that is done, the planner will consider using them.

-- 
Andrew, Supernews
http://www.supernews.com - individual and corporate NNTP services


pgsql-sql by date:

Previous
From: "TJ O'Donnell"
Date:
Subject: several questions about R-tree index
Next
From: Tom Lane
Date:
Subject: Re: several questions about R-tree index