[postgis-users] Can I build an index on combined non-spatial & spatial columns?

M.A. (Thijs) van den Berg thijs at sitmo.com
Wed Mar 18 02:57:10 PDT 2009

Suppose I want to speedup the following  type of queries with an index:

SELECT the_geom, building_name
  FROM buildings
  WHERE Distance(the_geom, 'POINT(100312 102312)') < 5000
  AND building_type = 'School'

Is that possible, and if not, why not? My current option is to write  
my own index storage in C++, using a hashmap to filter building_type,  
and build separate spatial indices for each building type. Can I do  
something similar in postgresql? Would my only option be to split the  
building_types into separate tables?

More information about the postgis-users mailing list