I would like to know if it's interesting to create an index on an other column than the geom one.

In some cases, I would like to do spatial analysis. If not, I would like to analyse only attributes.

So, should I make a second index on an alpha/numeric field?

EDIT: The practical case is few inserts (adn feature by feature) and a lot of selects on spatial or attributes (one main field as an ID (int) ) or both

  • 1
    Probably the index will speed up your queries. You can use EXPLAIN to see if index is used. – Zoltan Mar 29 at 16:11
  • Yes, as for any table. Having a geometry or a spatial index is irrelevant when considering adding a(nother) index. Field selectivity, usage in a sort by etc are the key factors – JGH Mar 29 at 20:45
  • This is more a pure SQL than GIS question. Adding indexes improves some query performance, but always slows INSERT performance. We don't have enough information about your exact use pattern to make anything but an opinion-based answer. – Vince Mar 30 at 12:16
  • ok @Vince, i added a practical case. – jlSta Apr 2 at 8:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.