1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-24 14:22:24 +03:00
Files
config
contrib
adminpack
auth_delay
auto_explain
btree_gin
btree_gist
data
expected
bit.out
bytea.out
cash.out
char.out
char_1.out
cidr.out
date.out
float4.out
float8.out
inet.out
init.out
int2.out
int4.out
int8.out
interval.out
macaddr.out
not_equal.out
numeric.out
oid.out
text.out
text_1.out
time.out
timestamp.out
timestamptz.out
timetz.out
varbit.out
varchar.out
varchar_1.out
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/expected/int4.out
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

92 lines
1.5 KiB
Plaintext

-- int4 check
CREATE TABLE int4tmp (a int4);
\copy int4tmp from 'data/int2.data'
SET enable_seqscan=on;
SELECT count(*) FROM int4tmp WHERE a < 237;
count
-------
297
(1 row)
SELECT count(*) FROM int4tmp WHERE a <= 237;
count
-------
298
(1 row)
SELECT count(*) FROM int4tmp WHERE a = 237;
count
-------
1
(1 row)
SELECT count(*) FROM int4tmp WHERE a >= 237;
count
-------
249
(1 row)
SELECT count(*) FROM int4tmp WHERE a > 237;
count
-------
248
(1 row)
SELECT a, a <-> '237' FROM int4tmp ORDER BY a <-> '237' LIMIT 3;
a | ?column?
-----+----------
237 | 0
232 | 5
228 | 9
(3 rows)
CREATE INDEX int4idx ON int4tmp USING gist ( a );
SET enable_seqscan=off;
SELECT count(*) FROM int4tmp WHERE a < 237::int4;
count
-------
297
(1 row)
SELECT count(*) FROM int4tmp WHERE a <= 237::int4;
count
-------
298
(1 row)
SELECT count(*) FROM int4tmp WHERE a = 237::int4;
count
-------
1
(1 row)
SELECT count(*) FROM int4tmp WHERE a >= 237::int4;
count
-------
249
(1 row)
SELECT count(*) FROM int4tmp WHERE a > 237::int4;
count
-------
248
(1 row)
EXPLAIN (COSTS OFF)
SELECT a, a <-> '237' FROM int4tmp ORDER BY a <-> '237' LIMIT 3;
QUERY PLAN
-------------------------------------------
Limit
-> Index Scan using int4idx on int4tmp
Order By: (a <-> 237)
(3 rows)
SELECT a, a <-> '237' FROM int4tmp ORDER BY a <-> '237' LIMIT 3;
a | ?column?
-----+----------
237 | 0
232 | 5
228 | 9
(3 rows)