[postgis-users] Visualize sp-GiST index structure

Felix Kunde felix-kunde at gmx.de
Tue Mar 5 13:21:14 PST 2019

Hi there,
I'm trying to use Gevel to print the structure of my sp-GiST indexes. For GiST, it works fine as descibed here: https://gist.github.com/Komzpa/f9e1c241d1d2a27cf5a4f985f646f8a6
But for spgist_print I'm getting error with the leaf_values.
  ST_SetSRID(replace(prefix::text, '2DF', '')::box2d::geometry, 4326) as geom,
  tid, allthesame, node_n, level, tid_pointer, node_label, leaf_value
 spgist_print('pts16_spgist') as t
            tid tid,
            allthesame bool,
            node_n int, 
            level int, 
            tid_pointer tid, 
            prefix box2df, 
            node_label int,
            leaf_value geometry
ERROR: Unknown geometry type: 1128379426 - Invalid type

As long as I only select levels where leaf_value is null it works.
Was hoping I could get an unterstanding how the index is structured by looking only at the prefix boxes, but they are so small an only lie in the center of my dataset. I've attached a file, where I have copied the prefixes of the first three levels. At level 4, I'm getting errors.

Has anybody already tried this before?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: spgist_levels_1_2_3
Type: application/octet-stream
Size: 12859 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20190305/22a76cd8/attachment.obj>

More information about the postgis-users mailing list