Engineering

PostGIS for India: a 28-state, 742-district geo-index

Lessons learned indexing every Indian pincode with a tight latency budget.

Vinod J.
Vinod J.
CTO
9 minApril 8, 2026
PostGIS for India: a 28-state, 742-district geo-index

Building geo-search for India means indexing 30,000+ pincodes, 742 districts and 28 states with sub-200ms lookup. PostGIS makes it doable — but the defaults will not get you there.

GiST vs SP-GiST

We benchmarked both. For our workload — nearest-neighbour with 2-3 secondary filters — GiST won by ~18%.

The KNN gotcha

The <-> operator is the magic that makes "nearest 10 cold storages to me" a single query. But you need a covering index that includes the geom column, or it falls back to a full scan.

Found this useful? Share it.