1-- int8 check
2CREATE TABLE int8tmp (a int8);
3\copy int8tmp from 'data/int8.data'
4SET enable_seqscan=on;
5SELECT count(*) FROM int8tmp WHERE a <  464571291354841;
6 count
7-------
8   276
9(1 row)
10
11SELECT count(*) FROM int8tmp WHERE a <= 464571291354841;
12 count
13-------
14   277
15(1 row)
16
17SELECT count(*) FROM int8tmp WHERE a  = 464571291354841;
18 count
19-------
20     1
21(1 row)
22
23SELECT count(*) FROM int8tmp WHERE a >= 464571291354841;
24 count
25-------
26   271
27(1 row)
28
29SELECT count(*) FROM int8tmp WHERE a >  464571291354841;
30 count
31-------
32   270
33(1 row)
34
35SELECT a, a <-> '464571291354841' FROM int8tmp ORDER BY a <-> '464571291354841' LIMIT 3;
36        a        |    ?column?
37-----------------+----------------
38 464571291354841 |              0
39 457257666629329 |  7313624725512
40 478227196042750 | 13655904687909
41(3 rows)
42
43CREATE INDEX int8idx ON int8tmp USING gist ( a );
44SET enable_seqscan=off;
45SELECT count(*) FROM int8tmp WHERE a <  464571291354841::int8;
46 count
47-------
48   276
49(1 row)
50
51SELECT count(*) FROM int8tmp WHERE a <= 464571291354841::int8;
52 count
53-------
54   277
55(1 row)
56
57SELECT count(*) FROM int8tmp WHERE a  = 464571291354841::int8;
58 count
59-------
60     1
61(1 row)
62
63SELECT count(*) FROM int8tmp WHERE a >= 464571291354841::int8;
64 count
65-------
66   271
67(1 row)
68
69SELECT count(*) FROM int8tmp WHERE a >  464571291354841::int8;
70 count
71-------
72   270
73(1 row)
74
75EXPLAIN (COSTS OFF)
76SELECT a, a <-> '464571291354841' FROM int8tmp ORDER BY a <-> '464571291354841' LIMIT 3;
77                     QUERY PLAN
78-----------------------------------------------------
79 Limit
80   ->  Index Only Scan using int8idx on int8tmp
81         Order By: (a <-> '464571291354841'::bigint)
82(3 rows)
83
84SELECT a, a <-> '464571291354841' FROM int8tmp ORDER BY a <-> '464571291354841' LIMIT 3;
85        a        |    ?column?
86-----------------+----------------
87 464571291354841 |              0
88 457257666629329 |  7313624725512
89 478227196042750 | 13655904687909
90(3 rows)
91
92