2001-06-01 02:27:18 +08:00
|
|
|
--
|
|
|
|
-- 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
|
|
|
|
|
2002-10-19 02:41:22 +08:00
|
|
|
CREATE TABLE boxtmp (b box);
|
2001-06-01 02:27:18 +08:00
|
|
|
|
|
|
|
\copy boxtmp from 'data/test_box.data'
|
|
|
|
|
2002-10-19 02:41:22 +08:00
|
|
|
SELECT count(*)
|
|
|
|
FROM boxtmp
|
|
|
|
WHERE b && '(1000,1000,0,0)'::box;
|
2001-06-01 02:27:18 +08:00
|
|
|
|
2002-10-19 02:41:22 +08:00
|
|
|
CREATE INDEX bix ON boxtmp USING rtree (b);
|
2001-06-01 02:27:18 +08:00
|
|
|
|
2002-10-19 02:41:22 +08:00
|
|
|
SELECT count(*)
|
|
|
|
FROM boxtmp
|
|
|
|
WHERE b && '(1000,1000,0,0)'::box;
|
2001-06-01 02:27:18 +08:00
|
|
|
|
2002-10-19 02:41:22 +08:00
|
|
|
DROP INDEX bix;
|
2001-06-01 02:27:18 +08:00
|
|
|
|
2002-10-19 02:41:22 +08:00
|
|
|
CREATE INDEX bix ON boxtmp USING gist (b);
|
2001-06-01 02:27:18 +08:00
|
|
|
|
2002-10-19 02:41:22 +08:00
|
|
|
SELECT count(*)
|
|
|
|
FROM boxtmp
|
|
|
|
WHERE b && '(1000,1000,0,0)'::box;
|
2001-06-01 02:27:18 +08:00
|
|
|
|
2002-10-19 02:41:22 +08:00
|
|
|
CREATE TABLE polytmp (p polygon);
|
2001-06-01 02:27:18 +08:00
|
|
|
|
|
|
|
\copy polytmp from 'data/test_box.data'
|
|
|
|
|
2002-10-19 02:41:22 +08:00
|
|
|
CREATE INDEX pix ON polytmp USING rtree (p);
|
2001-06-01 02:27:18 +08:00
|
|
|
|
2002-10-19 02:41:22 +08:00
|
|
|
SELECT count(*)
|
|
|
|
FROM polytmp
|
|
|
|
WHERE p && '(1000,1000),(0,0)'::polygon;
|
2001-06-01 02:27:18 +08:00
|
|
|
|
2002-10-19 02:41:22 +08:00
|
|
|
DROP INDEX pix;
|
2001-06-01 02:27:18 +08:00
|
|
|
|
2002-10-19 02:41:22 +08:00
|
|
|
CREATE INDEX pix ON polytmp USING gist (p);
|
2001-06-01 02:27:18 +08:00
|
|
|
|
2002-10-19 02:41:22 +08:00
|
|
|
SELECT count(*)
|
|
|
|
FROM polytmp
|
|
|
|
WHERE p && '(1000,1000),(0,0)'::polygon;
|