Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfc75d07

Browse files
committed
Uncommented tests for experimental spoint3 opclass.
Added a small KNN test (for spoint3 opclass).
1 parent3a7f241 commitfc75d07

File tree

4 files changed

+52
-12
lines changed

4 files changed

+52
-12
lines changed

‎Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ REGRESS = init tables points euler circle line ellipse poly path box index \
2424
contains_ops contains_ops_compat bounding_box_gist gnomo healpix\
2525
moc
2626

27-
REGRESS_9_5 = index_9.5# experimental for spoint3
27+
REGRESS_9_5 = index_9.5knn# experimental for spoint3
2828

2929
TESTS = init_test tables points euler circle line ellipse poly path box index\
3030
contains_ops contains_ops_compat bounding_box_gist gnomo healpix\
@@ -81,11 +81,11 @@ has_explain_summary = $(if $(filter-out 9.%,$(pg_version)),y,n)
8181
#
8282

8383
## the use of spoint 3 is too experimental and preliminary:
84-
#ifeq ($(pg_version_9_5_plus),y)
85-
#REGRESS += $(REGRESS_9_5)
86-
#TESTS += $(REGRESS_9_5)
87-
#PGS_SQL += $(PGS_SQL_9_5)
88-
#endif
84+
ifeq ($(pg_version_9_5_plus),y)
85+
REGRESS += $(REGRESS_9_5)
86+
TESTS += $(REGRESS_9_5)
87+
PGS_SQL += $(PGS_SQL_9_5)
88+
endif
8989

9090
crushtest: REGRESS +=$(CRUSH_TESTS)
9191
crushtest: installcheck

‎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-
-> IndexOnlyScan using spoint3_idx on spheretmp1b
9+
-> Index 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-
-> IndexOnlyScan using spoint3_idx on spheretmp1b
23+
-> Index Scan using spoint3_idx on spheretmp1b
2424
Index Cond: (p = '(3.09 , 1.25)'::spoint)
2525
(3 rows)
2626

‎expected/knn.out

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
CREATE TABLE points (id int, p spoint, pos int);
2+
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;
16+
pos | n
17+
-----+----
18+
1 | 1
19+
2 | 2
20+
3 | 3
21+
4 | 4
22+
5 | 5
23+
6 | 6
24+
7 | 7
25+
8 | 8
26+
9 | 9
27+
10 | 10
28+
(10 rows)
29+
30+
DROP TABLE points;

‎sql/knn.sql

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CREATETABLEpoints (idint, p spoint, posint);
2+
INSERT INTO points (id, p)SELECT x, spoint(random()*6.28, (2*random()-1)*1.57)FROM generate_series(1,314159) x;
3+
CREATEINDEXiON points USING gist (p spoint3);
4+
SET enable_indexscan= true;
5+
EXPLAIN (costs off)SELECT p<-> spoint (0.2,0.3)FROM pointsORDER BY1LIMIT10;
6+
UPDATE pointsSET pos= nFROM (SELECT id, row_number() OVER (ORDER BY p<-> spoint (0.2,0.3)) nFROM pointsORDER BY p<-> spoint (0.2,0.3)LIMIT10) selWHEREpoints.id=sel.id;
7+
SET enable_indexscan= false;
8+
SELECT pos, row_number() OVER (ORDER BY p<-> spoint (0.2,0.3)) nFROM pointsORDER BY p<-> spoint (0.2,0.3)LIMIT10;
9+
DROPTABLE points;
10+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp