Chapter 10. GiST インデックス

The information about GIST is at http://GiST.CS.Berkeley.EDU:8000/gist/ with more on different indexing and sorting schemes at http://s2k-ftp.CS.Berkeley.EDU:8000/personal/jmh/ And there is more interesting reading at the Berkely database site at http://epoch.cs.berkeley.edu:8000/.

Gist についての情報は http://GiST.CS.Berkeley.EDU:8000/gist/ にあります。 他のインデックスとソートに関するスキーマは http://s2k-ftp.CS.Berkeley.EDU:8000/personal/jmh/ にあります。 また、バークレイ・データベースのサイト http://epoch.cs.berkeley.edu:8000/. により興味深い記事があります。

著者: This extraction from an e-mail sent by Eugene Selkov Jr. contains good information on GiST. Hopefully we will learn more in the future and update this information. - thomas 1998-03-01

これは、 Eugene Selkov Jr.氏に よるメールから抜き出したものであり、GiST に関する優れた情報が含まれて います。たぶん、今後もっと調査を行ない、この情報を更新する予定です。

Well, I can't say I quite understand what's going on, but at least I (almost) succeeded in porting GiST examples to linux. The GiST access method is already in the postgres tree (src/backend/access/gist).

ところで、何をしているのかをちゃんと理解しているとはいえませんが、 少なくとも、GiST の例を linux に移植することに(大体)成功しました。 GiST アクセスメソッドは既に postgres のツリー ( src/backend/access/gist )にあります。

Examples at Berkeley come with an overview of the methods and demonstrate spatial index mechanisms for 2D boxes, polygons, integer intervals and text (see also GiST at Berkeley). In the box example, we are supposed to see a performance gain when using the GiST index; it did work for me but I do not have a reasonably large collection of boxes to check that. Other examples also worked, except polygons: I got an error doing

バークレイでの例 は、そのメソッドの概略を示し、また、2 次元ボックス、多角形、整数間 隔、テキスト用の空間的インデックスのデモを行なっています。 ( バークレイでのGist を参照して下さい。)ボックス用の例で、GiST インデックスを使った場 合性能が向上していることが分かるだろうと思います。私のところではう まく動きましたが、適当な量のボックスの集合を使っては試していません。 多角形を除いて、他の例もうまく動作しました。多角形の場合、以下のエ ラーになりました。

test=> create index pix on polytmp
test-> using gist (p:box gist_poly_ops) with (islossy);
ERROR:  cannot open pix

(PostgreSQL 6.3               Sun Feb  1 14:57:30 EST 1998)

I could not get sense of this error message; it appears to be something we'd rather ask the developers about (see also Note 4 below). What I would suggest here is that someone of you linux guys (linux==gcc?) fetch the original sources quoted above and apply my patch (see attachment) and tell us what you feel about it. Looks cool to me, but I would not like to hold it up while there are so many competent people around.

私にはこのエラーメッセージの意味が理解できませんでした。開発者に聞 いたほうが良さそうです。(後述のメモ 4 を見て下さい。)私がここで提 案したいことは、linux ユーザのどなたかに上で引用した元来のソースを 入手して、私が作ったパッチ(添付参照)を適用して、そして、その感想 を聞かせて欲しいということです。私は結構いけてると思いましたが、多 くの有能な方々がいらっしゃるので、このパッチに固執するつもりはあり ません。

A few notes on the sources:

ソースに関するメモを数個、下に示します。

1. I failed to make use of the original (HPUX) Makefile and rearranged the Makefile from the ancient postgres95 tutorial to do the job. I tried to keep it generic, but I am a very poor makefile writer -- just did some monkey work. Sorry about that, but I guess it is now a little more portable that the original makefile.

1. 元々の( HPUX 用の) Makefile を使って make することはできませんで した。昔の postgres95 のチュートリアルを参考に Makefile を再構成し、 make を行ないました。一般的な形を保持しようと思いましたが、makefile 作成には長けていませんので、素人仕事となってしまいました。この点 は謝罪しますが、元々の makefile より移植性に優れたものになったと思っ ています。

2. I built the example sources right under pgsql/src (just extracted the tar file there). The aforementioned Makefile assumes it is one level below pgsql/src (in our case, in pgsql/src/pggist).

2. 例のソースを( tar ファイルを展開するとできる)pgsql/src 下の適 当なところで構築しました。前述の Makefile では、pgsql/src の 1 階層 下のディレクトリにあるものとして扱っています。(今回は pgsql/src/pggist にあります。)

3. The changes I made to the *.c files were all about #include's, function prototypes and typecasting. Other than that, I just threw away a bunch of unused vars and added a couple parentheses to please gcc. I hope I did not screw up too much :)

3. 私が *.c ファイルに行なった変更は、全て #includeでの関数プロト タイプと型キャストに関することです。これ以外に、使用していない変数 群の削除と gcc を通すための 2 つの括弧の追加を行なっています。私が 台無しにしていなければいいのですが :)

4. There is a comment in polyproc.sql:

-- -- there's a memory leak in rtree poly_ops!!
-- -- create index pix2 on polytmp using rtree (p poly_ops);
Roger that!! I thought it could be related to a number of Postgres versions back and tried the query. My system went nuts and I had to shoot down the postmaster in about ten minutes.

4. polyproc.sql に次のようなコメントがあります。

-- -- there's a memory leak in rtree poly_ops!!
-- -- create index pix2 on polytmp using rtree (p poly_ops);
了解!! 何世代か前の Postgres に関するものと 思い、その問い合わせを試みました。私のシステムはおかしくなって しまい、およそ 10 分後 postmaster を停止させなければならなくな りました。

I will continue to look into GiST for a while, but I would also appreciate more examples of R-tree usage.

しばらくは GiST に注目していきます。が、R-tree の多くの例にも感謝 をしています。