summaryrefslogtreecommitdiffstats
path: root/contrib/btree_gin/sql/name.sql
blob: c11580cdf96097c65dd52e1fb013c7189fa9a132 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
set enable_seqscan=off;

CREATE TABLE test_name (
	i name
);

INSERT INTO test_name VALUES ('a'),('ab'),('abc'),('abb'),('axy'),('xyz');

CREATE INDEX idx_name ON test_name USING gin (i);

SELECT * FROM test_name WHERE i<'abc' ORDER BY i;
SELECT * FROM test_name WHERE i<='abc' ORDER BY i;
SELECT * FROM test_name WHERE i='abc' ORDER BY i;
SELECT * FROM test_name WHERE i>='abc' ORDER BY i;
SELECT * FROM test_name WHERE i>'abc' ORDER BY i;

EXPLAIN (COSTS OFF) SELECT * FROM test_name WHERE i<'abc' ORDER BY i;
EXPLAIN (COSTS OFF) SELECT * FROM test_name WHERE i<='abc' ORDER BY i;
EXPLAIN (COSTS OFF) SELECT * FROM test_name WHERE i='abc' ORDER BY i;
EXPLAIN (COSTS OFF) SELECT * FROM test_name WHERE i>='abc' ORDER BY i;
EXPLAIN (COSTS OFF) SELECT * FROM test_name WHERE i>'abc' ORDER BY i;