summaryrefslogtreecommitdiff
path: root/contrib/rtree_gist/bench/create_test.pl
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-05-31 18:27:18 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-05-31 18:27:18 +0000
commit16f85390f205dafc9d663c3bf777d682ccbdd1dd (patch)
tree440aba94402949b0414353adc6d1c94ca2bdbf48 /contrib/rtree_gist/bench/create_test.pl
parent3043810d977b8197f9671c98439104db80b8e914 (diff)
Support for emulating RTREE indexing in GiST. Contributed by
Oleg Bartunov and Teodor Sigaev.
Diffstat (limited to 'contrib/rtree_gist/bench/create_test.pl')
-rwxr-xr-xcontrib/rtree_gist/bench/create_test.pl50
1 files changed, 50 insertions, 0 deletions
diff --git a/contrib/rtree_gist/bench/create_test.pl b/contrib/rtree_gist/bench/create_test.pl
new file mode 100755
index 00000000000..1c06b6863d3
--- /dev/null
+++ b/contrib/rtree_gist/bench/create_test.pl
@@ -0,0 +1,50 @@
+#!/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];
+}