Re: indices and cidr/inet type - Mailing list pgsql-general

From Tom Lane
Subject Re: indices and cidr/inet type
Date
Msg-id 13850.1060123607@sss.pgh.pa.us
Whole thread Raw
In response to Re: indices and cidr/inet type  (Richard Welty <rwelty@averillpark.net>)
Responses Re: indices and cidr/inet type  (Richard Welty <rwelty@averillpark.net>)
List pgsql-general
Richard Welty <rwelty@averillpark.net> writes:
> On Tue, 05 Aug 2003 15:09:00 -0400 Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I don't think we have a suitable index type at the moment; or more
>> accurately, we don't have a suitable operator class.  It would be an
>> interesting exercise to write an inet opclass for either rtree or GiST.

> hmmm. where should i go looking for sample code implementing operator
> classes as an example?

contrib.  Specifically, I'd suggest looking at contrib/seg, which
defines a datatype for "interval on the real line" and builds a GIST
opclass for it.  This seems like it'd map very easily to CIDR subnets.
There is a lot of cruft in contrib/seg that you don't need (at least
some coming from the fact that it originally was an rtree opclass not
a GiST opclass --- in GiST you can make your own choices about what
set of operators need to be supported, but seg just slavishly follows
the rtree design).  But it's a working example...

I'd also suggest trying to get Oleg and Teodor involved, as they are the
only active hackers who have done anything much with GiST.

            regards, tom lane

pgsql-general by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: optimum postgres server configuration
Next
From: The Hermit Hacker
Date:
Subject: v7.4 Beta 1 Bundle Available for Testing ...