Skip to content

Commit 73a07e3

Browse files
authoredOct 4, 2023
Merge pull request #74 from cybertec-postgresql/spoint3_fetch
Spoint3 fetch
2 parents 1066514 + c2a2351 commit 73a07e3

13 files changed

+89
-102
lines changed
 

‎Makefile

+5-14
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ DATA_built = $(RELEASE_SQL) \
3030
pg_sphere--1.2.1--1.2.2.sql \
3131
pg_sphere--1.2.2--1.2.3.sql \
3232
pg_sphere--1.2.3--1.3.0.sql \
33-
pg_sphere--1.3.0--1.3.1.sql
33+
pg_sphere--1.3.0--1.3.1.sql \
34+
pg_sphere--1.3.1--1.3.2.sql
3435

3536
DOCS = README.pg_sphere COPYRIGHT.pg_sphere
3637
REGRESS = init tables points euler circle line ellipse poly path box index \
@@ -41,8 +42,6 @@ ifneq ($(USE_HEALPIX),0)
4142
REGRESS += healpix moc mocautocast
4243
endif
4344

44-
REGRESS_9_5 = index_9.5 # experimental for spoint3
45-
4645
TESTS = init_test tables points euler circle line ellipse poly path box \
4746
index contains_ops contains_ops_compat bounding_box_gist gnomo \
4847
epochprop contains overlaps spoint_brin sbox_brin
@@ -83,8 +82,6 @@ endif
8382

8483
PGS_SQL += pgs_epochprop.sql
8584

86-
PGS_SQL_9_5 = pgs_9.5.sql # experimental for spoint3
87-
8885
ifdef USE_PGXS
8986
ifndef PG_CONFIG
9087
PG_CONFIG = pg_config
@@ -111,18 +108,9 @@ endif
111108
healpix_bare/healpix_bare.o : healpix_bare/healpix_bare.c
112109
$(COMPILE.c) -Wno-declaration-after-statement -o $@ $^
113110

114-
# experimental for spoint3
115111
pg_version := $(word 2,$(shell $(PG_CONFIG) --version))
116-
pg_version_9_5_plus = $(if $(filter-out 9.1% 9.2% 9.3% 9.4%,$(pg_version)),y,n)
117112
has_explain_summary = $(if $(filter-out 9.%,$(pg_version)),y,n)
118113

119-
## the use of spoint 3 is too experimental and preliminary:
120-
#ifeq ($(pg_version_9_5_plus),y)
121-
# REGRESS += $(REGRESS_9_5)
122-
# TESTS += $(REGRESS_9_5)
123-
# PGS_SQL += $(PGS_SQL_9_5)
124-
#endif
125-
126114
crushtest: REGRESS += $(CRUSH_TESTS)
127115
crushtest: installcheck
128116

@@ -258,6 +246,9 @@ pg_sphere--1.2.3--1.3.0.sql: pgs_brin.sql.in
258246
pg_sphere--1.3.0--1.3.1.sql:
259247
cat upgrade_scripts/$@.in > $@
260248

249+
pg_sphere--1.3.1--1.3.2.sql:
250+
cat upgrade_scripts/$@.in > $@
251+
261252
# end of local stuff
262253

263254
src/sscan.o : src/sparse.c

‎Makefile.common.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
#----------------------------------------------------------------------------
66

77
EXTENSION := pg_sphere
8-
PGSPHERE_VERSION := 1.3.1
8+
PGSPHERE_VERSION := 1.3.2

‎expected/index.out

+61
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,64 @@ SELECT count(*) FROM spheretmp4 WHERE l && scircle '<(1,1),0.3>' ;
134134
40
135135
(1 row)
136136

137+
-- test spoint3 operator class with and without index-only scan
138+
SET enable_bitmapscan = OFF;
139+
SET enable_indexonlyscan = ON;
140+
EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1),0.3>';
141+
QUERY PLAN
142+
--------------------------------------------------------
143+
Aggregate
144+
-> Index Only Scan using spoint3_idx on spheretmp1b
145+
Index Cond: (p <@ '<(1 , 1) , 0.3>'::scircle)
146+
(3 rows)
147+
148+
SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1),0.3>';
149+
count
150+
-------
151+
32
152+
(1 row)
153+
154+
EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1.25)';
155+
QUERY PLAN
156+
--------------------------------------------------------
157+
Aggregate
158+
-> Index Only Scan using spoint3_idx on spheretmp1b
159+
Index Cond: (p = '(3.09 , 1.25)'::spoint)
160+
(3 rows)
161+
162+
SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1.25)';
163+
count
164+
-------
165+
4
166+
(1 row)
167+
168+
SET enable_bitmapscan = ON;
169+
SET enable_indexonlyscan = OFF;
170+
EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1),0.3>';
171+
QUERY PLAN
172+
-------------------------------------------------------
173+
Aggregate
174+
-> Index Scan using spoint3_idx on spheretmp1b
175+
Index Cond: (p <@ '<(1 , 1) , 0.3>'::scircle)
176+
(3 rows)
177+
178+
SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1),0.3>';
179+
count
180+
-------
181+
32
182+
(1 row)
183+
184+
EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1.25)';
185+
QUERY PLAN
186+
---------------------------------------------------
187+
Aggregate
188+
-> Index Scan using spoint3_idx on spheretmp1b
189+
Index Cond: (p = '(3.09 , 1.25)'::spoint)
190+
(3 rows)
191+
192+
SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1.25)';
193+
count
194+
-------
195+
4
196+
(1 row)
197+

‎expected/index_9.5.out

-62
This file was deleted.

‎expected/init.out

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ CREATE EXTENSION pg_sphere;
66
select pg_sphere_version();
77
pg_sphere_version
88
-------------------
9-
1.3.1
9+
1.3.2
1010
(1 row)
1111

‎expected/init_test_healpix.out.in

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
psql:pg_sphere.test.sql:9684: NOTICE: return type smoc is only a shell
2-
psql:pg_sphere.test.sql:9690: NOTICE: argument type smoc is only a shell
1+
psql:pg_sphere.test.sql:9685: NOTICE: return type smoc is only a shell
2+
psql:pg_sphere.test.sql:9691: NOTICE: argument type smoc is only a shell

‎index_9.5

Whitespace-only changes.
File renamed without changes.

‎pg_sphere.control

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# pg_sphere extension
22
comment = 'spherical objects with useful functions, operators and index support'
3-
default_version = '1.3.1'
3+
default_version = '1.3.2'
44
module_pathname = '$libdir/pg_sphere'
55
relocatable = true

‎pgs_gist_spoint3.sql.in

+1
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,5 @@ CREATE OPERATOR CLASS spoint3
6666
FUNCTION 6 g_spoint3_picksplit (internal, internal),
6767
FUNCTION 7 g_spoint3_same (bytea, bytea, internal),
6868
FUNCTION 8 g_spoint3_distance (internal, internal, int4, oid),
69+
FUNCTION 9 (spoint, spoint) g_spoint3_fetch (internal),
6970
STORAGE pointkey;

‎sql/index.sql

+17
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,20 @@ SELECT count(*) FROM spheretmp4 WHERE l @ scircle '<(1,1),0.3>' ;
5959

6060
SELECT count(*) FROM spheretmp4 WHERE l && scircle '<(1,1),0.3>' ;
6161

62+
-- test spoint3 operator class with and without index-only scan
63+
64+
SET enable_bitmapscan = OFF;
65+
SET enable_indexonlyscan = ON;
66+
67+
EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1),0.3>';
68+
SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1),0.3>';
69+
EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1.25)';
70+
SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1.25)';
71+
72+
SET enable_bitmapscan = ON;
73+
SET enable_indexonlyscan = OFF;
74+
75+
EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1),0.3>';
76+
SELECT count(*) FROM spheretmp1b WHERE p <@ scircle '<(1,1),0.3>';
77+
EXPLAIN (COSTS OFF) SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1.25)';
78+
SELECT count(*) FROM spheretmp1b WHERE p = spoint '(3.09 , 1.25)';

‎sql/index_9.5.sql

-18
This file was deleted.

‎pgs_9.5.sql.in renamed to ‎upgrade_scripts/pg_sphere--1.3.1--1.3.2.sql.in

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
-- add functionality that is only available for PostgreSQL 9.5+
2-
3-
41
-- add "fetch" support function to enable index-only scans for spoint3
52

63
ALTER OPERATOR FAMILY spoint3 USING gist ADD

0 commit comments

Comments
 (0)
Please sign in to comment.