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

CREATE TABLE test_bpchar (
	i char(10)
);

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

CREATE INDEX idx_bpchar ON test_bpchar USING gin (i);

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

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