Databend now ships a native spatial index built on R-Tree structures combined with Hilbert clustering for optimal data layout, accelerating spatial queries like proximity searches, range filtering, and spatial JOINs. Benchmarks against the SpatialBenchmark dataset show 5.5x faster nearby trip queries, 6.6x faster regional aggregation, and 8.3x faster spatial JOIN aggregation. The index currently supports the Geometry type only; Geography type queries must be converted to Geometry first to benefit from index acceleration. Target use cases include LBS, logistics/trajectory analysis, IoT geofencing, and GIS platforms.

8m read timeFrom databend.com
Post cover image
Table of contents
Why Do GIS Workloads Require Spatial Indexes?Databend GIS: Filling the Critical GapHow Does the Databend Spatial Index Accelerate Queries?Which Query Scenarios Benefit Directly?How to Use Databend Spatial IndexHow Much Performance Improvement?Business Scenarios That Benefit DirectlyCurrent LimitationsClosing Thoughts

Questions this post answers

How much faster are spatial JOIN queries in Databend after adding the spatial index?

Spatial JOIN aggregation queries run up to 8.3x faster with Databend's new spatial index. In a complex multi-table spatial join benchmark using the SpatialBenchmark dataset, query time dropped from 2315.718 seconds without the index to 279.571 seconds with it enabled. Simpler proximity queries using ST_DWithin saw a 5.5x speedup, and regional aggregation queries saw 6.6x. Teams evaluating databases for GIS workloads can track performance benchmarks like these on daily.dev.

Does Databend's spatial index support the Geography data type?

No, the spatial index currently only supports the Geometry type, not Geography. To get index acceleration on geographic (lat/lon) data, you need to convert it to Geometry first before querying. This makes the index best suited for planar or projected coordinate workloads rather than direct geographic coordinate queries. Developers weighing database GIS features against their coordinate system needs can follow updates like this on daily.dev.

What functions does Databend automatically accelerate with its new spatial index?

Databend's spatial index auto-accelerates four core spatial functions: ST_Intersects, ST_Contains, ST_Within, and ST_DWithin. These cover the two most common GIS query categories: spatial filtering in WHERE clauses (region searches, radius queries, geofences) and spatial JOIN analysis (matching locations against boundaries or service areas). Anyone choosing a data warehouse for spatial analytics can keep tabs on releases like this via daily.dev.

2 Impressions