1set enable_seqscan=off; 2CREATE TABLE test_name ( 3 i name 4); 5INSERT INTO test_name VALUES ('a'),('ab'),('abc'),('abb'),('axy'),('xyz'); 6CREATE INDEX idx_name ON test_name USING gin (i); 7SELECT * FROM test_name WHERE i<'abc' ORDER BY i; 8 i 9----- 10 a 11 ab 12 abb 13(3 rows) 14 15SELECT * FROM test_name WHERE i<='abc' ORDER BY i; 16 i 17----- 18 a 19 ab 20 abb 21 abc 22(4 rows) 23 24SELECT * FROM test_name WHERE i='abc' ORDER BY i; 25 i 26----- 27 abc 28(1 row) 29 30SELECT * FROM test_name WHERE i>='abc' ORDER BY i; 31 i 32----- 33 abc 34 axy 35 xyz 36(3 rows) 37 38SELECT * FROM test_name WHERE i>'abc' ORDER BY i; 39 i 40----- 41 axy 42 xyz 43(2 rows) 44 45EXPLAIN (COSTS OFF) SELECT * FROM test_name WHERE i<'abc' ORDER BY i; 46 QUERY PLAN 47--------------------------------------------- 48 Sort 49 Sort Key: i 50 -> Bitmap Heap Scan on test_name 51 Recheck Cond: (i < 'abc'::name) 52 -> Bitmap Index Scan on idx_name 53 Index Cond: (i < 'abc'::name) 54(6 rows) 55 56EXPLAIN (COSTS OFF) SELECT * FROM test_name WHERE i<='abc' ORDER BY i; 57 QUERY PLAN 58---------------------------------------------- 59 Sort 60 Sort Key: i 61 -> Bitmap Heap Scan on test_name 62 Recheck Cond: (i <= 'abc'::name) 63 -> Bitmap Index Scan on idx_name 64 Index Cond: (i <= 'abc'::name) 65(6 rows) 66 67EXPLAIN (COSTS OFF) SELECT * FROM test_name WHERE i='abc' ORDER BY i; 68 QUERY PLAN 69--------------------------------------- 70 Bitmap Heap Scan on test_name 71 Recheck Cond: (i = 'abc'::name) 72 -> Bitmap Index Scan on idx_name 73 Index Cond: (i = 'abc'::name) 74(4 rows) 75 76EXPLAIN (COSTS OFF) SELECT * FROM test_name WHERE i>='abc' ORDER BY i; 77 QUERY PLAN 78---------------------------------------------- 79 Sort 80 Sort Key: i 81 -> Bitmap Heap Scan on test_name 82 Recheck Cond: (i >= 'abc'::name) 83 -> Bitmap Index Scan on idx_name 84 Index Cond: (i >= 'abc'::name) 85(6 rows) 86 87EXPLAIN (COSTS OFF) SELECT * FROM test_name WHERE i>'abc' ORDER BY i; 88 QUERY PLAN 89--------------------------------------------- 90 Sort 91 Sort Key: i 92 -> Bitmap Heap Scan on test_name 93 Recheck Cond: (i > 'abc'::name) 94 -> Bitmap Index Scan on idx_name 95 Index Cond: (i > 'abc'::name) 96(6 rows) 97 98