2001-08-23 02:27:54 +08:00
|
|
|
--
|
|
|
|
-- first, define the datatype. Turn off echoing so that expected file
|
2003-02-19 11:46:00 +08:00
|
|
|
-- does not depend on contents of btree_gist.sql.
|
2001-08-23 02:27:54 +08:00
|
|
|
--
|
|
|
|
\set ECHO none
|
|
|
|
\i btree_gist.sql
|
|
|
|
\set ECHO all
|
|
|
|
|
2003-02-19 11:46:00 +08:00
|
|
|
CREATE TABLE int4tmp (b int4);
|
2001-08-23 02:27:54 +08:00
|
|
|
|
2003-02-19 11:46:00 +08:00
|
|
|
\copy int4tmp from 'data/test_btree.data'
|
|
|
|
|
|
|
|
CREATE TABLE int8tmp (b int8);
|
|
|
|
|
|
|
|
\copy int8tmp from 'data/test_btree.data'
|
|
|
|
|
|
|
|
CREATE TABLE float4tmp (b float4);
|
|
|
|
|
|
|
|
\copy float4tmp from 'data/test_btree.data'
|
|
|
|
|
|
|
|
CREATE TABLE float8tmp (b float8);
|
|
|
|
|
|
|
|
\copy float8tmp from 'data/test_btree.data'
|
2001-08-23 02:27:54 +08:00
|
|
|
|
2002-10-19 02:41:22 +08:00
|
|
|
CREATE TABLE tstmp ( t timestamp without time zone );
|
2001-08-23 02:27:54 +08:00
|
|
|
|
|
|
|
\copy tstmp from 'data/test_btree_ts.data'
|
|
|
|
|
|
|
|
-- without idx
|
|
|
|
|
2003-02-19 11:46:00 +08:00
|
|
|
SELECT count(*) FROM int4tmp WHERE b <=10;
|
|
|
|
|
|
|
|
SELECT count(*) FROM int8tmp WHERE b <=10;
|
|
|
|
|
|
|
|
SELECT count(*) FROM float4tmp WHERE b <=10;
|
|
|
|
|
|
|
|
SELECT count(*) FROM float8tmp WHERE b <=10;
|
2001-08-23 02:27:54 +08:00
|
|
|
|
2002-10-19 02:41:22 +08:00
|
|
|
SELECT count(*) FROM tstmp WHERE t < '2001-05-29 08:33:09';
|
2001-08-23 02:27:54 +08:00
|
|
|
|
|
|
|
-- create idx
|
|
|
|
|
2003-02-19 11:46:00 +08:00
|
|
|
CREATE INDEX aaaidx ON int4tmp USING gist ( b );
|
|
|
|
|
|
|
|
CREATE INDEX bbbidx ON int8tmp USING gist ( b );
|
|
|
|
|
|
|
|
CREATE INDEX cccidx ON float4tmp USING gist ( b );
|
|
|
|
|
|
|
|
CREATE INDEX dddidx ON float8tmp USING gist ( b );
|
2001-08-23 02:27:54 +08:00
|
|
|
|
2002-10-19 02:41:22 +08:00
|
|
|
CREATE INDEX tsidx ON tstmp USING gist ( t );
|
2001-08-23 02:27:54 +08:00
|
|
|
|
|
|
|
--with idx
|
|
|
|
|
2002-10-19 02:41:22 +08:00
|
|
|
SET enable_seqscan=off;
|
2001-08-23 02:27:54 +08:00
|
|
|
|
2003-02-19 11:46:00 +08:00
|
|
|
SELECT count(*) FROM int4tmp WHERE b <=10::int4;
|
|
|
|
|
|
|
|
SELECT count(*) FROM int8tmp WHERE b <=10::int8;
|
|
|
|
|
|
|
|
SELECT count(*) FROM float4tmp WHERE b <=10::float4;
|
|
|
|
|
|
|
|
SELECT count(*) FROM float8tmp WHERE b <=10::float8;
|
2001-08-23 02:27:54 +08:00
|
|
|
|
2002-10-19 02:41:22 +08:00
|
|
|
SELECT count(*) FROM tstmp WHERE t < '2001-05-29 08:33:09';
|
2001-08-23 02:27:54 +08:00
|
|
|
|