Company
Date Published
Author
Sumeer Bhola
Word count
2562
Language
English
Hacker News points
None

Summary

In response to the high demand for spatial data and indexing capabilities, CockroachDB introduced spatial data storage in its 20.2 release, aligning its features with the popular PostGIS extension while maintaining CockroachDB's scalability and resilience. The development involved choosing a "divide the space" approach using Google's S2 library to handle spatial indexing, as opposed to PostGIS's "divide the objects" method, which was incompatible with CockroachDB's dynamic horizontal scaling. This approach leverages a quad-tree structure for indexing and utilizes distributed query processors to efficiently handle spatial queries by reducing false positives through precise evaluations. The blog post details the mechanics of spatial indexing, including the benefits of the chosen method, such as simplified bulk ingestion and memory-efficient compactions, and outlines future enhancements like geo-partitioned indexes and query optimizations for other data types.