2001-08-22 20:27:54 +02:00
|
|
|
--
|
|
|
|
-- first, define the datatype. Turn off echoing so that expected file
|
|
|
|
-- does not depend on contents of seg.sql.
|
|
|
|
--
|
|
|
|
\set ECHO none
|
2002-11-01 23:46:04 +01:00
|
|
|
psql:btree_gist.sql:10: NOTICE: ProcedureCreate: type int4key is not yet defined
|
|
|
|
psql:btree_gist.sql:15: NOTICE: Argument type "int4key" is only a shell
|
|
|
|
psql:btree_gist.sql:98: NOTICE: ProcedureCreate: type tskey is not yet defined
|
|
|
|
psql:btree_gist.sql:103: NOTICE: Argument type "tskey" is only a shell
|
2002-10-18 20:41:22 +02:00
|
|
|
CREATE TABLE inttmp (b int4);
|
2001-08-22 20:27:54 +02:00
|
|
|
\copy inttmp from 'data/test_btree.data'
|
2002-10-18 20:41:22 +02:00
|
|
|
CREATE TABLE tstmp ( t timestamp without time zone );
|
2001-08-22 20:27:54 +02:00
|
|
|
\copy tstmp from 'data/test_btree_ts.data'
|
|
|
|
-- without idx
|
2002-10-18 20:41:22 +02:00
|
|
|
SELECT count(*) FROM inttmp WHERE b <=10;
|
2001-08-22 20:27:54 +02:00
|
|
|
count
|
|
|
|
-------
|
|
|
|
11
|
|
|
|
(1 row)
|
|
|
|
|
2002-10-18 20:41:22 +02:00
|
|
|
SELECT count(*) FROM tstmp WHERE t < '2001-05-29 08:33:09';
|
2001-08-22 20:27:54 +02:00
|
|
|
count
|
|
|
|
-------
|
2001-10-03 20:39:12 +02:00
|
|
|
66
|
2001-08-22 20:27:54 +02:00
|
|
|
(1 row)
|
|
|
|
|
|
|
|
-- create idx
|
2002-10-18 20:41:22 +02:00
|
|
|
CREATE INDEX aaaidx ON inttmp USING gist ( b );
|
|
|
|
CREATE INDEX tsidx ON tstmp USING gist ( t );
|
2001-08-22 20:27:54 +02:00
|
|
|
--with idx
|
2002-10-18 20:41:22 +02:00
|
|
|
SET enable_seqscan=off;
|
|
|
|
SELECT count(*) FROM inttmp WHERE b <=10;
|
2001-08-22 20:27:54 +02:00
|
|
|
count
|
|
|
|
-------
|
|
|
|
11
|
|
|
|
(1 row)
|
|
|
|
|
2002-10-18 20:41:22 +02:00
|
|
|
SELECT count(*) FROM tstmp WHERE t < '2001-05-29 08:33:09';
|
2001-08-22 20:27:54 +02:00
|
|
|
count
|
|
|
|
-------
|
2001-10-03 20:39:12 +02:00
|
|
|
66
|
2001-08-22 20:27:54 +02:00
|
|
|
(1 row)
|
|
|
|
|