Re: Indexing for geographic objects? - Mailing list pgsql-hackers

From selkovjr@mcs.anl.gov
Subject Re: Indexing for geographic objects?
Date
Msg-id 200011261915.NAA15183@selkovjr.xnet.com
Whole thread Raw
In response to RE: Indexing for geographic objects?  (Oleg Bartunov <oleg@sai.msu.su>)
List pgsql-hackers
Oleg Bartunov <oleg@sai.msu.su> wrote:
>
> I'm also interested in GiST and would be happy if somebody could provide
> workable example. I have an idea to use GiST indices for our fulltextsearch
> system.
>

I have recently replied to Franck Martin in regards to this indexing
question, but I didn't think the subject was popular enough for me to
contaminate the list(s). You prove me wrong. Here goes:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To: Franck Martin <franck@sopac.org>
From: selkovjr@mcs.anl.gov
Reply-to: selkovjr@mcs.anl.gov
Subject: Re: [HACKERS] Indexing for geographic objects?
In-reply-to: <3A1EE0F4.3DC4161B@sopac.org>
Comments: In-reply-to Franck Martin <franck@sopac.org>
   message dated "Sat, 25 Nov 2000 10:43:16 +1300."
Mime-Version: 1.0 (generated by tm-edit 7.108)
Date: Sat, 25 Nov 2000 02:56:03 -0600

It is probably possible to hook up an extension directly with the
R-tree methods available in postgres -- if you stare at the code long
enough and figure how to use the correct strategies. I chose an easier
path years ago and I am still satisfied with the results. Check out
the GiST -- a general access method built on top of R-tree to provide
a user-friendly interface to it and to allow indexing of more abstract
types, for which straight R-tree is not directly applicable.

I have a small set of complete data types, of which a couple
illustrate the use of GiST indexing with the geometrical objects, in:

http://wit.mcs.anl.gov/~selkovjr/pg_extensions/

If you are using a pre-7.0 postrgres, grab the file contrib.tgz,
otherwise take contrib-7.0.tgz. The difference is insignificant, but
the pre-7.0 version will not fit the current schema. Unpack the source
into postgresql-*/contrib and follow instructions in the README
files. The types of interest for you will be seg and cube. You will
find pointers to the original sources and docs in the CREDITS section
of the README file. I also have a version of the original example code
in pggist-patched.tgz, but I did not check if it works with current
postgres. It should not be difficult to fix it if it doesn't -- the
recent development in the optimizer area made certain things
unnecessary.

You might want to check out a working example of the segment data type at:

http://wit.mcs.anl.gov/EMP/indexing.html

(search the page for 'KM')

I will be glad to help, but I would also recommend to send more
sophisticated questions to Joe Hellerstein, the leader of the original
postgres team that developed GiST. He was very helpful whenever I
turned to him during the early stages of my data type project.

--Gene


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: LIKE optimization and locale
Next
From: Tom Samplonius
Date:
Subject: Re: Re: [NOVICE] Re: re : PHP and persistent connections