You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
INSERT INTO points (id, p) SELECT x, spoint(random()*6.28, (2*random()-1)*1.57) FROM generate_series(1,314159) x;
3
+
CREATE INDEX i ON points USING gist (p spoint3);
4
+
SET enable_indexscan = true;
5
+
EXPLAIN (costs off) SELECT p <-> spoint (0.2, 0.3) FROM points ORDER BY 1 LIMIT 10;
6
+
QUERY PLAN
7
+
-------------------------------------------------
8
+
Limit
9
+
-> Index Scan using i on points
10
+
Order By: (p <-> '(0.2 , 0.3)'::spoint)
11
+
(3 rows)
12
+
13
+
UPDATE points SET pos = n FROM (SELECT id, row_number() OVER (ORDER BY p <-> spoint (0.2, 0.3)) n FROM points ORDER BY p <-> spoint (0.2, 0.3) LIMIT 10) sel WHERE points.id = sel.id;
14
+
SET enable_indexscan = false;
15
+
SELECT pos, row_number() OVER (ORDER BY p <-> spoint (0.2, 0.3)) n FROM points ORDER BY p <-> spoint (0.2, 0.3) LIMIT 10;