2001-08-22 20:27:54 +02:00
|
|
|
--
|
|
|
|
-- first, define the datatype. Turn off echoing so that expected file
|
2003-02-19 04:46:00 +01:00
|
|
|
-- does not depend on contents of btree_gist.sql.
|
2001-08-22 20:27:54 +02:00
|
|
|
--
|
|
|
|
\set ECHO none
|
2003-03-28 18:24:28 +01:00
|
|
|
psql:btree_gist.sql:10: NOTICE: ProcedureCreate: type int2key is not yet defined
|
|
|
|
psql:btree_gist.sql:15: NOTICE: Argument type "int2key" is only a shell
|
|
|
|
psql:btree_gist.sql:27: NOTICE: ProcedureCreate: type int4key is not yet defined
|
|
|
|
psql:btree_gist.sql:32: NOTICE: Argument type "int4key" is only a shell
|
|
|
|
psql:btree_gist.sql:44: NOTICE: ProcedureCreate: type int8key is not yet defined
|
|
|
|
psql:btree_gist.sql:49: NOTICE: Argument type "int8key" is only a shell
|
|
|
|
psql:btree_gist.sql:61: NOTICE: ProcedureCreate: type float4key is not yet defined
|
|
|
|
psql:btree_gist.sql:66: NOTICE: Argument type "float4key" is only a shell
|
|
|
|
psql:btree_gist.sql:79: NOTICE: ProcedureCreate: type float8key is not yet defined
|
|
|
|
psql:btree_gist.sql:84: NOTICE: Argument type "float8key" is only a shell
|
|
|
|
psql:btree_gist.sql:394: NOTICE: ProcedureCreate: type tskey is not yet defined
|
|
|
|
psql:btree_gist.sql:399: NOTICE: Argument type "tskey" is only a shell
|
2003-02-19 04:46:00 +01:00
|
|
|
CREATE TABLE int4tmp (b int4);
|
|
|
|
\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'
|
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
|
2003-02-19 04:46:00 +01:00
|
|
|
SELECT count(*) FROM int4tmp WHERE b <=10;
|
|
|
|
count
|
|
|
|
-------
|
|
|
|
11
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
SELECT count(*) FROM int8tmp WHERE b <=10;
|
|
|
|
count
|
|
|
|
-------
|
|
|
|
11
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
SELECT count(*) FROM float4tmp WHERE b <=10;
|
|
|
|
count
|
|
|
|
-------
|
|
|
|
11
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
SELECT count(*) FROM float8tmp 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
|
2003-02-19 04:46:00 +01: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 );
|
2002-10-18 20:41:22 +02:00
|
|
|
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;
|
2003-02-19 04:46:00 +01:00
|
|
|
SELECT count(*) FROM int4tmp WHERE b <=10::int4;
|
|
|
|
count
|
|
|
|
-------
|
|
|
|
11
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
SELECT count(*) FROM int8tmp WHERE b <=10::int8;
|
|
|
|
count
|
|
|
|
-------
|
|
|
|
11
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
SELECT count(*) FROM float4tmp WHERE b <=10::float4;
|
|
|
|
count
|
|
|
|
-------
|
|
|
|
11
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
SELECT count(*) FROM float8tmp WHERE b <=10::float8;
|
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)
|
|
|
|
|