Back to feed
Dev.to
Dev.to
6/25/2026
Spatial Search Performance: How I Got 100x Faster Queries With PostGIS and Redis GEO

Spatial Search Performance: How I Got 100x Faster Queries With PostGIS and Redis GEO

Short summary

Author optimized location-based queries from 8s to 30ms using two techniques: storing coordinates in WGS84 but querying in Web Mercator projection for accurate distances, plus Redis GEO caching for hot regions. The combined strategy achieved ~260x speedup with full Go/GORM code examples included.

  • Store spatial data in WGS84, query in Web Mercator projection for accurate distance calculations
  • Layer Redis GEO caching on top of PostGIS to avoid repeated database hits for popular regions
  • Combined optimization reduced query time from 8 seconds to 30ms (~260x faster)

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Explore more