blob: ebd0ef3d689a14a40e6ca991352753065c764eba (
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
|
-- float8 check
CREATE TABLE float8tmp (a float8);
\copy float8tmp from 'data/float8.data'
SET enable_seqscan=on;
SELECT count(*) FROM float8tmp WHERE a < -1890.0;
count
-------
237
(1 row)
SELECT count(*) FROM float8tmp WHERE a <= -1890.0;
count
-------
238
(1 row)
SELECT count(*) FROM float8tmp WHERE a = -1890.0;
count
-------
1
(1 row)
SELECT count(*) FROM float8tmp WHERE a >= -1890.0;
count
-------
307
(1 row)
SELECT count(*) FROM float8tmp WHERE a > -1890.0;
count
-------
306
(1 row)
SELECT a, a <-> '-1890.0' FROM float8tmp ORDER BY a <-> '-1890.0' LIMIT 3;
a | ?column?
--------------+--------------------
-1890 | 0
-2003.634512 | 113.63451200000009
-1769.73634 | 120.26366000000007
(3 rows)
CREATE INDEX float8idx ON float8tmp USING gist ( a );
SET enable_seqscan=off;
SELECT count(*) FROM float8tmp WHERE a < -1890.0::float8;
count
-------
237
(1 row)
SELECT count(*) FROM float8tmp WHERE a <= -1890.0::float8;
count
-------
238
(1 row)
SELECT count(*) FROM float8tmp WHERE a = -1890.0::float8;
count
-------
1
(1 row)
SELECT count(*) FROM float8tmp WHERE a >= -1890.0::float8;
count
-------
307
(1 row)
SELECT count(*) FROM float8tmp WHERE a > -1890.0::float8;
count
-------
306
(1 row)
EXPLAIN (COSTS OFF)
SELECT a, a <-> '-1890.0' FROM float8tmp ORDER BY a <-> '-1890.0' LIMIT 3;
QUERY PLAN
-----------------------------------------------------
Limit
-> Index Only Scan using float8idx on float8tmp
Order By: (a <-> '-1890'::double precision)
(3 rows)
SELECT a, a <-> '-1890.0' FROM float8tmp ORDER BY a <-> '-1890.0' LIMIT 3;
a | ?column?
--------------+--------------------
-1890 | 0
-2003.634512 | 113.63451200000009
-1769.73634 | 120.26366000000007
(3 rows)
|