[postgis-tickets] [PostGIS] #5025: Inconsistent behavior with ST_Within across versions
PostGIS
trac at osgeo.org
Tue Jul 26 10:36:50 PDT 2022
#5025: Inconsistent behavior with ST_Within across versions
----------------------+---------------------------
Reporter: byrman | Owner: pramsey
Type: defect | Status: new
Priority: medium | Milestone: PostGIS 3.0.7
Component: postgis | Version: 3.1.x
Resolution: | Keywords:
----------------------+---------------------------
Comment (by pramsey):
Dispensing with all the index creation above simplifies things a little
and just on my latest pg14/postgis3.2 installation we can at least get a
workable issue that doesn't involve juggling docker images.
{{{
pramsey=# explain SELECT COUNT(*) FROM a, b WHERE ST_Within(a.geom,
b.geom);
QUERY PLAN
----------------------------------------------------------------
Aggregate (cost=2505.26..2505.27 rows=1 width=8)
-> Nested Loop (cost=0.00..2505.01 rows=100 width=0)
Join Filter: st_within(a.geom, b.geom)
-> Seq Scan on b (cost=0.00..1.01 rows=1 width=168)
-> Seq Scan on a (cost=0.00..3.00 rows=100 width=40)
(5 rows)
pramsey=# CREATE INDEX a_3d_idx ON a USING GIST(geom
gist_geometry_ops_nd);
CREATE INDEX
pramsey=# explain SELECT COUNT(*) FROM a, b WHERE ST_Within(a.geom,
b.geom);
QUERY PLAN
--------------------------------------------------------------------------------
Aggregate (cost=34.42..34.43 rows=1 width=8)
-> Nested Loop (cost=0.14..34.17 rows=100 width=0)
-> Seq Scan on b (cost=0.00..1.01 rows=1 width=168)
-> Index Scan using a_3d_idx on a (cost=0.14..33.16 rows=1
width=40)
Index Cond: (geom @@ b.geom)
Filter: st_within(geom, b.geom)
(6 rows)
}}}
There was some changes to the way 3D indexes worked in the last few
revisions, from komzpa, I cannot recall when though, or even why. The
question of "is something within in 3d" is a little open, particularly if
the two operands are of different dimensionality.
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5025#comment:6>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-tickets
mailing list