]> granicus.if.org Git - postgresql/blob - doc/src/sgml/gist.sgml
SGML source for new documentation.
[postgresql] / doc / src / sgml / gist.sgml
1 <Chapter>
2 <DocInfo>
3 <AuthorGroup>
4 <Author>
5 <FirstName>Gene</FirstName>
6 <Surname>Selkov</Surname>
7 </Author>
8 </AuthorGroup>
9 <Date>Transcribed 1998-02-19</Date>
10 </DocInfo>
11 <Title>GiST Indices</Title>
12
13 <Para>
14 <Note>
15 <Title>Caveat</Title>
16 <Para>
17 This extraction from an e-mail sent by 
18 <ULink url="mailto:selkovjr@mcs.anl.gov">Eugene Selkov Jr.</ULink>
19 contains good information
20 on GiST. Hopefully we will learn more in the future and update this information.
21 - thomas
22 </Para>
23 </Note>
24
25 <Para>
26 Well, I can't say I quite understand what's going on, but at least
27 I (almost) succeeded in porting GiST examples to linux. The GiST access
28 method is already in the postgres tree (<FileName>src/backend/access/gist</FileName>).
29
30 <Para>
31 <ULink url="ftp://s2k-ftp.cs.berkeley.edu/pub/gist/pggist/pggist.tgz">Examples at Berkeley</ULink>
32 come with an overview of the methods and demonstrate spatial index 
33 mechanisms for 2D boxes, polygons, integer intervals and text
34 (see also <ULink url="http://gist.cs.berkeley.edu:8000/gist/">GiST at Berkeley</ULink>).
35 In the box example, we
36 are supposed to see a performance gain when using the GiST index; it did
37 work for me but I do not have a reasonably large collection of boxes
38 to check that. Other examples also worked, except polygons: I got an 
39 error doing
40
41 <ProgramListing>
42 test=> create index pix on polytmp using gist (p:box gist_poly_ops) with
43 (islossy);
44 ERROR:  cannot open pix
45
46 (PostgreSQL 6.3               Sun Feb  1 14:57:30 EST 1998)
47 </ProgramListing>
48
49 <Para>
50 I could not get sense of this error message; it appears to be something
51 we'd rather ask the developers about (see also Note 4 below). What I
52 would suggest here is that someone of you linux guys (linux==gcc?) fetch the 
53 original sources quoted above and apply my patch (see attachment) and 
54 tell us what you feel about it. Looks cool to me, but I would not like 
55 to hold it up while there are so many competent people around.
56
57 <Para>
58 A few notes on the sources:
59
60 <Para>
61 1. I failed to make use of the original (HPUX) Makefile and rearranged
62    the Makefile from the ancient postgres95 tutorial to do the job. I
63 tried
64    to keep it generic, but I am a very poor makefile writer -- just did
65    some monkey work. Sorry about that, but I guess it is now a little
66    more portable that the original makefile.
67
68 <Para>
69 2. I built the example sources right under pgsql/src (just extracted the
70    tar file there). The aforementioned Makefile assumes it is one level
71    below pgsql/src (in our case, in pgsql/src/pggist).
72
73 <Para>
74 3. The changes I made to the *.c files were all about #include's,
75    function prototypes and typecasting. Other than that, I just threw 
76    away a bunch of unused vars and added a couple parentheses to please
77    gcc. I hope I did not screw up too much :)
78
79 <Para>
80 4. There is a comment in polyproc.sql:
81
82 <ProgramListing>
83 -- -- there's a memory leak in rtree poly_ops!!
84 -- -- create index pix2 on polytmp using rtree (p poly_ops);
85 </ProgramListing>
86
87    Roger that!! I thought it could be related to a number of
88    <ProductName>Postgres</ProductName> versions
89    back and tried the query. My system went nuts and I had to shoot down
90    the postmaster in about ten minutes.
91
92
93 <Para>
94 I will continue to look into GiST for a while, but I would also
95 appreciate
96 more examples of R-tree usage.
97
98 </Chapter>