blob: 60fd8d6016412f6bf70d1cfeff15a0dddc3f49dc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
set enable_seqscan=off;
CREATE TABLE test_uuid (
i uuid
);
INSERT INTO test_uuid VALUES
( '00000000-0000-0000-0000-000000000000' ),
( '299bc99f-2f79-4e3e-bfea-2cbfd62a7c27' ),
( '6264af33-0d43-4337-bf4e-43509b8a4be8' ),
( 'ce41c936-6acb-4feb-8c91-852a673e5a5c' ),
( 'd2ce731f-f2a8-4a2b-be37-8f0ba637427f' ),
( 'ffffffff-ffff-ffff-ffff-ffffffffffff' )
;
CREATE INDEX idx_uuid ON test_uuid USING gin (i);
SELECT * FROM test_uuid WHERE i<'ce41c936-6acb-4feb-8c91-852a673e5a5c'::uuid ORDER BY i;
i
--------------------------------------
00000000-0000-0000-0000-000000000000
299bc99f-2f79-4e3e-bfea-2cbfd62a7c27
6264af33-0d43-4337-bf4e-43509b8a4be8
(3 rows)
SELECT * FROM test_uuid WHERE i<='ce41c936-6acb-4feb-8c91-852a673e5a5c'::uuid ORDER BY i;
i
--------------------------------------
00000000-0000-0000-0000-000000000000
299bc99f-2f79-4e3e-bfea-2cbfd62a7c27
6264af33-0d43-4337-bf4e-43509b8a4be8
ce41c936-6acb-4feb-8c91-852a673e5a5c
(4 rows)
SELECT * FROM test_uuid WHERE i='ce41c936-6acb-4feb-8c91-852a673e5a5c'::uuid ORDER BY i;
i
--------------------------------------
ce41c936-6acb-4feb-8c91-852a673e5a5c
(1 row)
SELECT * FROM test_uuid WHERE i>='ce41c936-6acb-4feb-8c91-852a673e5a5c'::uuid ORDER BY i;
i
--------------------------------------
ce41c936-6acb-4feb-8c91-852a673e5a5c
d2ce731f-f2a8-4a2b-be37-8f0ba637427f
ffffffff-ffff-ffff-ffff-ffffffffffff
(3 rows)
SELECT * FROM test_uuid WHERE i>'ce41c936-6acb-4feb-8c91-852a673e5a5c'::uuid ORDER BY i;
i
--------------------------------------
d2ce731f-f2a8-4a2b-be37-8f0ba637427f
ffffffff-ffff-ffff-ffff-ffffffffffff
(2 rows)
EXPLAIN (COSTS OFF) SELECT * FROM test_uuid WHERE i<'ce41c936-6acb-4feb-8c91-852a673e5a5c'::uuid ORDER BY i;
QUERY PLAN
------------------------------------------------------------------------------
Sort
Sort Key: i
-> Bitmap Heap Scan on test_uuid
Recheck Cond: (i < 'ce41c936-6acb-4feb-8c91-852a673e5a5c'::uuid)
-> Bitmap Index Scan on idx_uuid
Index Cond: (i < 'ce41c936-6acb-4feb-8c91-852a673e5a5c'::uuid)
(6 rows)
EXPLAIN (COSTS OFF) SELECT * FROM test_uuid WHERE i<='ce41c936-6acb-4feb-8c91-852a673e5a5c'::uuid ORDER BY i;
QUERY PLAN
-------------------------------------------------------------------------------
Sort
Sort Key: i
-> Bitmap Heap Scan on test_uuid
Recheck Cond: (i <= 'ce41c936-6acb-4feb-8c91-852a673e5a5c'::uuid)
-> Bitmap Index Scan on idx_uuid
Index Cond: (i <= 'ce41c936-6acb-4feb-8c91-852a673e5a5c'::uuid)
(6 rows)
EXPLAIN (COSTS OFF) SELECT * FROM test_uuid WHERE i='ce41c936-6acb-4feb-8c91-852a673e5a5c'::uuid ORDER BY i;
QUERY PLAN
------------------------------------------------------------------------
Bitmap Heap Scan on test_uuid
Recheck Cond: (i = 'ce41c936-6acb-4feb-8c91-852a673e5a5c'::uuid)
-> Bitmap Index Scan on idx_uuid
Index Cond: (i = 'ce41c936-6acb-4feb-8c91-852a673e5a5c'::uuid)
(4 rows)
EXPLAIN (COSTS OFF) SELECT * FROM test_uuid WHERE i>='ce41c936-6acb-4feb-8c91-852a673e5a5c'::uuid ORDER BY i;
QUERY PLAN
-------------------------------------------------------------------------------
Sort
Sort Key: i
-> Bitmap Heap Scan on test_uuid
Recheck Cond: (i >= 'ce41c936-6acb-4feb-8c91-852a673e5a5c'::uuid)
-> Bitmap Index Scan on idx_uuid
Index Cond: (i >= 'ce41c936-6acb-4feb-8c91-852a673e5a5c'::uuid)
(6 rows)
EXPLAIN (COSTS OFF) SELECT * FROM test_uuid WHERE i>'ce41c936-6acb-4feb-8c91-852a673e5a5c'::uuid ORDER BY i;
QUERY PLAN
------------------------------------------------------------------------------
Sort
Sort Key: i
-> Bitmap Heap Scan on test_uuid
Recheck Cond: (i > 'ce41c936-6acb-4feb-8c91-852a673e5a5c'::uuid)
-> Bitmap Index Scan on idx_uuid
Index Cond: (i > 'ce41c936-6acb-4feb-8c91-852a673e5a5c'::uuid)
(6 rows)
|