Skip to content

Commit 7d8e477

Browse files
committed
Slightly improved tests
1 parent fc75d07 commit 7d8e477

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

expected/index_9.5.out

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ SET enable_seqscan = OFF;
33
SET enable_bitmapscan = OFF;
44
SET enable_indexonlyscan = ON;
55
EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1),0.3>';
6-
QUERY PLAN
7-
-------------------------------------------------------
6+
QUERY PLAN
7+
--------------------------------------------------------
88
Aggregate
9-
-> Index Scan using spoint3_idx on spheretmp1b
9+
-> Index Only Scan using spoint3_idx on spheretmp1b
1010
Index Cond: (p <@ '<(1 , 1) , 0.3>'::scircle)
1111
(3 rows)
1212

@@ -17,10 +17,10 @@ EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1),
1717
(1 row)
1818

1919
EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1.25)';
20-
QUERY PLAN
21-
---------------------------------------------------
20+
QUERY PLAN
21+
--------------------------------------------------------
2222
Aggregate
23-
-> Index Scan using spoint3_idx on spheretmp1b
23+
-> Index Only Scan using spoint3_idx on spheretmp1b
2424
Index Cond: (p = '(3.09 , 1.25)'::spoint)
2525
(3 rows)
2626

expected/knn.out

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,22 @@ EXPLAIN (costs off) SELECT p <-> spoint (0.2, 0.3) FROM points ORDER BY 1 LIMIT
66
QUERY PLAN
77
-------------------------------------------------
88
Limit
9-
-> Index Scan using i on points
9+
-> Index Only Scan using i on points
1010
Order By: (p <-> '(0.2 , 0.3)'::spoint)
1111
(3 rows)
1212

1313
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;
1414
SET enable_indexscan = false;
15+
SET enable_indexonlyscan = false;
16+
EXPLAIN (costs off) SELECT p <-> spoint (0.2, 0.3) FROM points ORDER BY 1 LIMIT 10;
17+
QUERY PLAN
18+
---------------------------------------------------
19+
Limit
20+
-> Sort
21+
Sort Key: ((p <-> '(0.2 , 0.3)'::spoint))
22+
-> Seq Scan on points
23+
(4 rows)
24+
1525
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;
1626
pos | n
1727
-----+----

sql/knn.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ SET enable_indexscan = true;
55
EXPLAIN (costs off) SELECT p <-> spoint (0.2, 0.3) FROM points ORDER BY 1 LIMIT 10;
66
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;
77
SET enable_indexscan = false;
8+
SET enable_indexonlyscan = false;
9+
EXPLAIN (costs off) SELECT p <-> spoint (0.2, 0.3) FROM points ORDER BY 1 LIMIT 10;
810
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;
911
DROP TABLE points;
1012

0 commit comments

Comments
 (0)