[postgis-tickets] [PostGIS] #3932: Enable Index Only Scan on geometry

PostGIS trac at osgeo.org
Tue Nov 21 22:15:32 PST 2017


#3932: Enable Index Only Scan on geometry
---------------------+---------------------------
 Reporter:  x4m      |      Owner:  pramsey
     Type:  defect   |     Status:  new
 Priority:  medium   |  Milestone:  PostGIS 2.4.2
Component:  postgis  |    Version:  2.4.x
 Keywords:           |
---------------------+---------------------------
 GiST support IoS since PostgreSQL 9.6, but geometry opclass do not have
 necessary function.
 It is easy to add this function by simply calling
 alter operator family gist_geometry_ops_nd using gist add function 9
 (geometry,geometry) geometry_gist_decompress_nd (internal);
 The trick is this query reuse geometry_gist_decompress_nd function,
 because fetch function for geometry is same no-op.
 For future extensibility reasons it is viable to copy
 geometry_gist_decompress_nd() into geometry_gist_fetch_nd().

 This will allow something like this (when IoS is more performant than
 other plans)
 postgres=# set enable_seqscan = off;
 SET
 postgres=# set enable_bitmapscan = false ;
 SET
 postgres=# explain select c from datatable where c &&
 ST_Expand(ST_MakePoint(0.1,0.1),0.1);
 QUERY PLAN
 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  Index Only Scan using idx on datatable  (cost=0.29..83264.29 rows=40839
 width=32)
    Filter: (c &&
 '010300000001000000050000000000000000000000000000000000000000000000000000009A9999999999C93F9A9999999999C93F9A9999999999C93F9A9999999999C93F000000000000000000000000000000000000000000000000'::geometry)
 (2 rows)

 I can submit a patch if you point out how to update this things properly
 in PostGIS.

--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/3932>
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