Re: several questions about R-tree index

From: Andrew - Supernews <andrew+nonews(at)supernews(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: several questions about R-tree index
Date: 2005-04-27 00:39:36
Message-ID: slrnd6tnq8.fpt.andrew+nonews@trinity.supernews.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 2005-04-26, "TJ O'Donnell" <tjo(at)acm(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2005-04-27 04:12:32 Re: several questions about R-tree index
Previous Message TJ O'Donnell 2005-04-26 23:52:05 several questions about R-tree index