Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
e6a8eba3
Commit
e6a8eba3
authored
Jul 01, 2005
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove contrib version of rtree_gist --- now in core system.
parent
e7e16942
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
1 addition
and
4436 deletions
+1
-4436
contrib/Makefile
contrib/Makefile
+1
-2
contrib/README
contrib/README
+0
-4
contrib/rtree_gist/Makefile
contrib/rtree_gist/Makefile
+0
-16
contrib/rtree_gist/README.rtree_gist
contrib/rtree_gist/README.rtree_gist
+0
-98
contrib/rtree_gist/bench/bench.pl
contrib/rtree_gist/bench/bench.pl
+0
-74
contrib/rtree_gist/bench/create_test.pl
contrib/rtree_gist/bench/create_test.pl
+0
-50
contrib/rtree_gist/data/test_box.data
contrib/rtree_gist/data/test_box.data
+0
-3378
contrib/rtree_gist/expected/rtree_gist.out
contrib/rtree_gist/expected/rtree_gist.out
+0
-55
contrib/rtree_gist/rtree_gist.c
contrib/rtree_gist/rtree_gist.c
+0
-599
contrib/rtree_gist/rtree_gist.sql.in
contrib/rtree_gist/rtree_gist.sql.in
+0
-113
contrib/rtree_gist/sql/rtree_gist.sql
contrib/rtree_gist/sql/rtree_gist.sql
+0
-47
No files found.
contrib/Makefile
View file @
e6a8eba3
# $PostgreSQL: pgsql/contrib/Makefile,v 1.5
6 2005/06/23 02:33:25
tgl Exp $
# $PostgreSQL: pgsql/contrib/Makefile,v 1.5
7 2005/07/01 19:23:04
tgl Exp $
subdir
=
contrib
subdir
=
contrib
top_builddir
=
..
top_builddir
=
..
...
@@ -27,7 +27,6 @@ WANTED_DIRS = \
...
@@ -27,7 +27,6 @@ WANTED_DIRS = \
pgbench
\
pgbench
\
pgcrypto
\
pgcrypto
\
pgstattuple
\
pgstattuple
\
rtree_gist
\
seg
\
seg
\
spi
\
spi
\
tablefunc
\
tablefunc
\
...
...
contrib/README
View file @
e6a8eba3
...
@@ -136,10 +136,6 @@ reindexdb -
...
@@ -136,10 +136,6 @@ reindexdb -
Reindexes a database
Reindexes a database
by Shaun Thomas <sthomas@townnews.com>
by Shaun Thomas <sthomas@townnews.com>
rtree_gist -
Support for emulating RTREE indexing in GiST
by Oleg Bartunov <oleg@sai.msu.su> and Teodor Sigaev <teodor@sigaev.ru>
seg -
seg -
Confidence-interval datatype (GiST indexing example)
Confidence-interval datatype (GiST indexing example)
by Gene Selkov, Jr. <selkovjr@mcs.anl.gov>
by Gene Selkov, Jr. <selkovjr@mcs.anl.gov>
...
...
contrib/rtree_gist/Makefile
deleted
100644 → 0
View file @
e7e16942
# $PostgreSQL: pgsql/contrib/rtree_gist/Makefile,v 1.5 2004/08/20 20:13:07 momjian Exp $
MODULES
=
rtree_gist
DATA_built
=
rtree_gist.sql
DOCS
=
README.rtree_gist
REGRESS
=
rtree_gist
ifdef
USE_PGXS
PGXS
=
$(
shell
pg_config
--pgxs
)
include
$(PGXS)
else
subdir
=
contrib/rtree_gist
top_builddir
=
../..
include
$(top_builddir)/src/Makefile.global
include
$(top_srcdir)/contrib/contrib-global.mk
endif
contrib/rtree_gist/README.rtree_gist
deleted
100644 → 0
View file @
e7e16942
This is a R-Tree implementation using GiST.
Code (for PG95) are taken from http://s2k-ftp.cs.berkeley.edu:8000/gist/pggist/
and changed according to new version of GiST (7.1 and above)
All work was done by Teodor Sigaev (teodor@stack.net) and Oleg Bartunov
(oleg@sai.msu.su). See http://www.sai.msu.su/~megera/postgres/gist
for additional information.
CHANGES:
Oct 10 MSD 2001
1. Implemented new linear algorithm for picksplit
ref. ( 'New Linear Node Splitting Algorithm for R-tree',
C.H.Ang and T.C.Tan )
Tue May 29 17:04:16 MSD 2001
1. Small fixes in polygon code
Thanks to Dave Blasby <dblasby@refractions.net>
Mon May 28 19:42:14 MSD 2001
1. Full implementation of R-tree using GiST - gist_box_ops,gist_poly_ops
2. gist_poly_ops is lossy
3. NULLs support
4. works with multi-key GiST
NOTICE:
This version will only work with PostgreSQL version 7.1 and above
because of changes in the function call interface.
INSTALLATION:
gmake
gmake install
-- load functions
psql <database> < rtree_gist.sql
REGRESSION TEST:
gmake installcheck
EXAMPLE USAGE:
create table boxtmp (b box);
-- create index
create index bix on boxtmp using gist (b gist_box_ops);
-- query
select * from boxtmp where b && '(1000,1000,0,0)'::box;
BENCHMARKS:
subdirectory bench contains benchmark suite.
Prerequisities: perl, DBI, DBD:Pg, Time::HiRes
cd ./bench
1. createdb TEST
2. psql TEST < ../rtree_gist.sql
3. ./create_test.pl | psql TEST
-- change $NUM - number of rows in test dataset
4. ./bench.pl - perl script to benchmark queries.
Run script without arguments to see available options.
a)test without GiST index, using built-in R-Tree
./bench.pl -d TEST
b)test R-Tree using GiST index
./bench.pl -d TEST -g
RESULTS:
1. One interesting thing is that insertion time for built-in R-Tree is
about 8 times more than ones for GiST implementation of R-Tree !!!
2. Postmaster requires much more memory for built-in R-Tree
3. Search time depends on dataset. In our case we got:
+------------+-----------+--------------+
|Number boxes|R-tree, sec|R-tree using |
| | | GiST, sec |
+------------+-----------+--------------+
| 10| 0.002| 0.002|
+------------+-----------+--------------+
| 100| 0.002| 0.002|
+------------+-----------+--------------+
| 1000| 0.002| 0.002|
+------------+-----------+--------------+
| 10000| 0.015| 0.025|
+------------+-----------+--------------+
| 20000| 0.029| 0.048|
+------------+-----------+--------------+
| 40000| 0.055| 0.092|
+------------+-----------+--------------+
| 80000| 0.113| 0.178|
+------------+-----------+--------------+
| 160000| 0.338| 0.337|
+------------+-----------+--------------+
| 320000| 0.674| 0.673|
+------------+-----------+--------------+
contrib/rtree_gist/bench/bench.pl
deleted
100755 → 0
View file @
e7e16942
#!/usr/bin/perl -w
use
strict
;
# make sure we are in a sane environment.
use
DBI
();
use
DBD::
Pg
();
use
Time::
HiRes
qw( usleep ualarm gettimeofday tv_interval )
;
use
Getopt::
Std
;
my
%
opt
;
getopts
('
d:b:gv
',
\%
opt
);
if
(
!
(
scalar
%
opt
)
)
{
print
<<EOT;
Usage:
$0 -d DATABASE -b N [-v] [-g]
-d DATABASE - DATABASE name
-b N -number of cycles
-v - print sql
-g -use GiST index( default built-in R-tree )
EOT
exit
;
}
$opt
{
d
}
||=
'
TEST
';
my
$dbi
=
DBI
->
connect
('
DBI:Pg:dbname=
'
.
$opt
{
d
})
||
die
"
Couldn't connect DB:
$opt
{d} !
\n
";
my
$setsql
=
qq{
SET search_path = public;
}
;
my
$sth
=
$dbi
->
prepare
(
$setsql
);
$sth
->
execute
();
my
$sql
;
my
$notice
;
my
$sss
=
'
(3000,3000,2990,2990)
';
if
(
$opt
{
g
}
)
{
$notice
=
"
Testing GiST implementation of R-Tree
";
$sql
=
"
select count(*) from boxtmp where b && '
$sss
'::box;
";
}
else
{
$notice
=
"
Testing built-in implementation of R-Tree
";
$sql
=
"
select count(*) from boxtmp2 where b && '
$sss
'::box;
";
}
my
$t0
=
[
gettimeofday
];
my
$count
=
0
;
my
$b
=
$opt
{
b
};
$b
||=
1
;
foreach
(
1
..
$b
)
{
my
@a
=
exec_sql
(
$dbi
,
$sql
);
$count
=
$#a
;
}
my
$elapsed
=
tv_interval
(
$t0
,
[
gettimeofday
]);
print
"
$notice
:
\n
";
print
"
$sql
\n
"
if
(
$opt
{
v
}
);
print
"
Done
\n
";
print
sprintf
("
total: %.02f sec; number: %d; for one: %.03f sec; found %d docs
\n
",
$elapsed
,
$b
,
$elapsed
/
$b
,
$count
+
1
);
$dbi
->
disconnect
;
sub
exec_sql
{
my
(
$dbi
,
$sql
,
@keys
)
=
@_
;
my
$sth
=
$dbi
->
prepare
(
$sql
)
||
die
;
$sth
->
execute
(
@keys
)
||
die
;
my
$r
;
my
@row
;
while
(
defined
(
$r
=
$sth
->
fetchrow_hashref
)
)
{
push
@row
,
$r
;
}
$sth
->
finish
;
return
@row
;
}
contrib/rtree_gist/bench/create_test.pl
deleted
100755 → 0
View file @
e7e16942
#!/usr/bin/perl
use
strict
;
my
$NUM
=
20000
;
print
"
DROP TABLE boxtmp;
\n
";
print
"
DROP TABLE boxtmp2;
\n
";
print
"
CREATE TABLE boxtmp (b box);
\n
";
print
"
CREATE TABLE boxtmp2 (b box);
\n
";
srand
(
1
);
open
(
DAT
,"
>bbb.dat
")
||
die
;
foreach
(
1
..
$NUM
)
{
#print DAT '(',int( 500+500*rand() ),',',int( 500+500*rand() ),',',int( 500*rand() ),',',int( 500*rand() ),")\n";
my
(
$x1
,
$y1
,
$x2
,
$y2
)
=
(
10000
*
rand
(),
10000
*
rand
(),
10000
*
rand
(),
10000
*
rand
()
);
print
DAT
'
(
',
max
(
$x1
,
$x2
),'
,
',
max
(
$y1
,
$y2
),'
,
',
min
(
$x1
,
$x2
),'
,
',
min
(
$y1
,
$y2
),"
)
\n
";
}
close
DAT
;
print
"
COPY boxtmp FROM stdin;
\n
";
open
(
DAT
,"
bbb.dat
")
||
die
;
while
(
<
DAT
>
)
{
print
;
}
close
DAT
;
print
"
\\
.
\n
";
print
"
COPY boxtmp2 FROM stdin;
\n
";
open
(
DAT
,"
bbb.dat
")
||
die
;
while
(
<
DAT
>
)
{
print
;
}
close
DAT
;
print
"
\\
.
\n
";
print
"
CREATE INDEX bix ON boxtmp USING gist (b gist_box_ops);
\n
";
print
"
CREATE INDEX bix2 ON boxtmp2 USING rtree (b box_ops);
\n
";
sub
min
{
return
(
$_
[
0
]
<
$_
[
1
]
)
?
$_
[
0
]
:
$_
[
1
];
}
sub
max
{
return
(
$_
[
0
]
>
$_
[
1
]
)
?
$_
[
0
]
:
$_
[
1
];
}
contrib/rtree_gist/data/test_box.data
deleted
100644 → 0
View file @
e7e16942
This diff is collapsed.
Click to expand it.
contrib/rtree_gist/expected/rtree_gist.out
deleted
100644 → 0
View file @
e7e16942
--
-- first, define the datatype. Turn off echoing so that expected file
-- does not depend on contents of seg.sql.
--
\set ECHO none
CREATE TABLE boxtmp (b box);
\copy boxtmp from 'data/test_box.data'
SELECT count(*)
FROM boxtmp
WHERE b && '(1000,1000,0,0)'::box;
count
-------
2
(1 row)
CREATE INDEX bix ON boxtmp USING rtree (b);
SELECT count(*)
FROM boxtmp
WHERE b && '(1000,1000,0,0)'::box;
count
-------
2
(1 row)
DROP INDEX bix;
CREATE INDEX bix ON boxtmp USING gist (b);
SELECT count(*)
FROM boxtmp
WHERE b && '(1000,1000,0,0)'::box;
count
-------
2
(1 row)
CREATE TABLE polytmp (p polygon);
\copy polytmp from 'data/test_box.data'
CREATE INDEX pix ON polytmp USING rtree (p);
SELECT count(*)
FROM polytmp
WHERE p && '(1000,1000),(0,0)'::polygon;
count
-------
2
(1 row)
DROP INDEX pix;
CREATE INDEX pix ON polytmp USING gist (p);
SELECT count(*)
FROM polytmp
WHERE p && '(1000,1000),(0,0)'::polygon;
count
-------
2
(1 row)
contrib/rtree_gist/rtree_gist.c
deleted
100644 → 0
View file @
e7e16942
This diff is collapsed.
Click to expand it.
contrib/rtree_gist/rtree_gist.sql.in
deleted
100644 → 0
View file @
e7e16942
-- Adjust this setting to control where the objects get created.
SET search_path = public;
--
--
--
-- BOX ops
--
--
--
-- define the GiST support methods
CREATE FUNCTION gbox_consistent(internal,box,int4)
RETURNS bool
AS 'MODULE_PATHNAME'
LANGUAGE 'C';
CREATE FUNCTION gbox_compress(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE 'C';
CREATE FUNCTION rtree_decompress(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE 'C';
CREATE FUNCTION gbox_penalty(internal,internal,internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE 'C' STRICT;
CREATE FUNCTION gbox_picksplit(internal, internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE 'C';
CREATE FUNCTION gbox_union(internal, internal)
RETURNS box
AS 'MODULE_PATHNAME'
LANGUAGE 'C';
CREATE FUNCTION gbox_same(box, box, internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE 'C';
-- create the operator class
CREATE OPERATOR CLASS gist_box_ops
DEFAULT FOR TYPE box USING gist
AS
OPERATOR 1 << ,
OPERATOR 2 &< ,
OPERATOR 3 && ,
OPERATOR 4 &> ,
OPERATOR 5 >> ,
OPERATOR 6 ~= ,
OPERATOR 7 ~ ,
OPERATOR 8 @ ,
OPERATOR 9 &<| ,
OPERATOR 10 <<| ,
OPERATOR 11 |>> ,
OPERATOR 12 |&> ,
FUNCTION 1 gbox_consistent (internal, box, int4),
FUNCTION 2 gbox_union (internal, internal),
FUNCTION 3 gbox_compress (internal),
FUNCTION 4 rtree_decompress (internal),
FUNCTION 5 gbox_penalty (internal, internal, internal),
FUNCTION 6 gbox_picksplit (internal, internal),
FUNCTION 7 gbox_same (box, box, internal);
--
--
--
-- POLYGON ops
--
--
--
-- define the GiST support methods
CREATE FUNCTION gpoly_consistent(internal,polygon,int4)
RETURNS bool
AS 'MODULE_PATHNAME'
LANGUAGE 'C';
CREATE FUNCTION gpoly_compress(internal)
RETURNS internal
AS 'MODULE_PATHNAME'
LANGUAGE 'C';
-- create the operator class
CREATE OPERATOR CLASS gist_poly_ops
DEFAULT FOR TYPE polygon USING gist
AS
OPERATOR 1 << RECHECK,
OPERATOR 2 &< RECHECK,
OPERATOR 3 && RECHECK,
OPERATOR 4 &> RECHECK,
OPERATOR 5 >> RECHECK,
OPERATOR 6 ~= RECHECK,
OPERATOR 7 ~ RECHECK,
OPERATOR 8 @ RECHECK,
OPERATOR 9 &<| RECHECK,
OPERATOR 10 <<| RECHECK,
OPERATOR 11 |>> RECHECK,
OPERATOR 12 |&> RECHECK,
FUNCTION 1 gpoly_consistent (internal, polygon, int4),
FUNCTION 2 gbox_union (internal, internal),
FUNCTION 3 gpoly_compress (internal),
FUNCTION 4 rtree_decompress (internal),
FUNCTION 5 gbox_penalty (internal, internal, internal),
FUNCTION 6 gbox_picksplit (internal, internal),
FUNCTION 7 gbox_same (box, box, internal),
STORAGE box;
contrib/rtree_gist/sql/rtree_gist.sql
deleted
100644 → 0
View file @
e7e16942
--
-- first, define the datatype. Turn off echoing so that expected file
-- does not depend on contents of seg.sql.
--
\
set
ECHO
none
\
i
rtree_gist
.
sql
\
set
ECHO
all
CREATE
TABLE
boxtmp
(
b
box
);
\
copy
boxtmp
from
'data/test_box.data'
SELECT
count
(
*
)
FROM
boxtmp
WHERE
b
&&
'(1000,1000,0,0)'
::
box
;
CREATE
INDEX
bix
ON
boxtmp
USING
rtree
(
b
);
SELECT
count
(
*
)
FROM
boxtmp
WHERE
b
&&
'(1000,1000,0,0)'
::
box
;
DROP
INDEX
bix
;
CREATE
INDEX
bix
ON
boxtmp
USING
gist
(
b
);
SELECT
count
(
*
)
FROM
boxtmp
WHERE
b
&&
'(1000,1000,0,0)'
::
box
;
CREATE
TABLE
polytmp
(
p
polygon
);
\
copy
polytmp
from
'data/test_box.data'
CREATE
INDEX
pix
ON
polytmp
USING
rtree
(
p
);
SELECT
count
(
*
)
FROM
polytmp
WHERE
p
&&
'(1000,1000),(0,0)'
::
polygon
;
DROP
INDEX
pix
;
CREATE
INDEX
pix
ON
polytmp
USING
gist
(
p
);
SELECT
count
(
*
)
FROM
polytmp
WHERE
p
&&
'(1000,1000),(0,0)'
::
polygon
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment