1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-14 08:21:07 +03:00
Files
config
contrib
adminpack
auth_delay
auto_explain
btree_gin
btree_gist
data
expected
sql
bit.sql
bytea.sql
cash.sql
char.sql
cidr.sql
date.sql
float4.sql
float8.sql
inet.sql
init.sql
int2.sql
int4.sql
int8.sql
interval.sql
macaddr.sql
not_equal.sql
numeric.sql
oid.sql
text.sql
time.sql
timestamp.sql
timestamptz.sql
timetz.sql
varbit.sql
varchar.sql
.gitignore
Makefile
btree_bit.c
btree_bytea.c
btree_cash.c
btree_date.c
btree_float4.c
btree_float8.c
btree_gist--1.0.sql
btree_gist--unpackaged--1.0.sql
btree_gist.c
btree_gist.control
btree_gist.h
btree_inet.c
btree_int2.c
btree_int4.c
btree_int8.c
btree_interval.c
btree_macaddr.c
btree_numeric.c
btree_oid.c
btree_text.c
btree_time.c
btree_ts.c
btree_utils_num.c
btree_utils_num.h
btree_utils_var.c
btree_utils_var.h
chkpass
citext
cube
dblink
dict_int
dict_xsyn
dummy_seclabel
earthdistance
file_fdw
fuzzystrmatch
hstore
intagg
intarray
isn
lo
ltree
oid2name
pageinspect
passwordcheck
pg_archivecleanup
pg_buffercache
pg_freespacemap
pg_prewarm
pg_standby
pg_stat_statements
pg_test_fsync
pg_test_timing
pg_trgm
pg_upgrade
pg_upgrade_support
pg_xlogdump
pgbench
pgcrypto
pgrowlocks
pgstattuple
postgres_fdw
seg
sepgsql
spi
sslinfo
start-scripts
tablefunc
tcn
test_decoding
test_parser
test_shm_mq
tsearch2
unaccent
uuid-ossp
vacuumlo
worker_spi
xml2
Makefile
README
contrib-global.mk
doc
src
.dir-locals.el
.gitattributes
.gitignore
COPYRIGHT
GNUmakefile.in
HISTORY
Makefile
README
README.git
aclocal.m4
configure
configure.in
postgres/contrib/btree_gist/sql/timestamp.sql
Tom Lane 8436489c81 Add KNNGIST support to contrib/btree_gist.
This extends GiST's support for nearest-neighbor searches to many of the
standard data types.

Teodor Sigaev
2011-03-02 14:44:33 -05:00

38 lines
1.3 KiB
SQL

-- timestamp check
CREATE TABLE timestamptmp (a timestamp);
\copy timestamptmp from 'data/timestamp.data'
SET enable_seqscan=on;
SELECT count(*) FROM timestamptmp WHERE a < '2004-10-26 08:55:08';
SELECT count(*) FROM timestamptmp WHERE a <= '2004-10-26 08:55:08';
SELECT count(*) FROM timestamptmp WHERE a = '2004-10-26 08:55:08';
SELECT count(*) FROM timestamptmp WHERE a >= '2004-10-26 08:55:08';
SELECT count(*) FROM timestamptmp WHERE a > '2004-10-26 08:55:08';
SELECT a, a <-> '2004-10-26 08:55:08' FROM timestamptmp ORDER BY a <-> '2004-10-26 08:55:08' LIMIT 3;
CREATE INDEX timestampidx ON timestamptmp USING gist ( a );
SET enable_seqscan=off;
SELECT count(*) FROM timestamptmp WHERE a < '2004-10-26 08:55:08'::timestamp;
SELECT count(*) FROM timestamptmp WHERE a <= '2004-10-26 08:55:08'::timestamp;
SELECT count(*) FROM timestamptmp WHERE a = '2004-10-26 08:55:08'::timestamp;
SELECT count(*) FROM timestamptmp WHERE a >= '2004-10-26 08:55:08'::timestamp;
SELECT count(*) FROM timestamptmp WHERE a > '2004-10-26 08:55:08'::timestamp;
EXPLAIN (COSTS OFF)
SELECT a, a <-> '2004-10-26 08:55:08' FROM timestamptmp ORDER BY a <-> '2004-10-26 08:55:08' LIMIT 3;
SELECT a, a <-> '2004-10-26 08:55:08' FROM timestamptmp ORDER BY a <-> '2004-10-26 08:55:08' LIMIT 3;