[postgis-devel] estimating quality of spatial indexes

Sandro Santilli strk at keybit.net
Tue Mar 3 03:07:31 PST 2015


On Tue, Mar 03, 2015 at 11:10:25AM +0100, Sandro Santilli wrote:
> On Tue, Mar 03, 2015 at 11:04:25AM +0100, RĂ©mi Cura wrote:
> > A while ago I would really have appreciated an easy way to visualize index.
> 
> I'm looking at it now. An N-dimensional index. Projecting level-1 nodes
> on the XY, XZ and XM planes (ST_SwapOrdinates!).
> 
> Done by implementing text output for BOX2DF and GIDX, and then
> convert that output to WKT using replace.
> 
> Will commit shortly, meanwhile get Gevel installed :)
> git://sigaev.ru/gevel

Text output function committed in r13297.
Here's how I look at an n-d index:

 -- Print the index (only level 1)
 create table tweets_g_nd_new_print_lvl1 as
   select * from gist_print('tweets_g_nd_new')
                 as t(level int, valid bool, a gidx)
   where level =1;

 -- Convert the index key (gidx/nd-box) to a geometry (XY plane)
 CREATE table tweets_g_nd_new_print_lvl1_xy as
   select ST_Envelope(
     ST_Force2D(replace(a::text, 'GIDX', 'LINESTRING')::geometry)
   ) as g
   from tweets_g_nd_new_print_lvl1;

 -- Convert the index key (gidx/nd-box) to a geometry (XM plane)
 create table tweets_g_nd_new_print_lvl1_xm as
   select ST_Envelope(
     ST_Force2D(
       ST_SwapOrdinates(
         replace(a::text, 'GIDX', 'LINESTRING')::geometry,
         'ym'
       )
     )
   ) as g
   from tweets_g_nd_new_print_lvl1;

--strk;



More information about the postgis-devel mailing list