6 min read
|
Saved February 14, 2026
|
Copied!
Do you care about this?
This article explains how Floe improves the performance of geo joins by using H3 indexes. Traditional spatial joins can be slow due to their quadratic complexity, but with H3, the process becomes a fast equi-join through a filtering step that reduces the number of candidates. The result is a significant speedup in geospatial queries.
If you do, here's more
Geo joins can significantly slow down database queries, especially as the size of the datasets increases. When using spatial predicates like `ST_Intersects`, the database often resorts to a costly loop join, leading to quadratic complexity. The article introduces a solution that leverages H3 indexing to rewrite these queries for improved performance. H3, developed by Uber, organizes the Earth into a grid of hexagonal cells, allowing geospatial data to be represented as sets of cell IDs. This transformation enables a more efficient equi-join instead of relying on expensive spatial comparisons.
The process involves generating H3 coverage for both datasets and performing a fast integer equi-join on the cell IDs. After this initial filtering, the system runs the exact spatial predicate on the reduced candidate set. The rewrite drastically cuts down the number of comparisons. In one example, a join between countries and cities reduced the candidate pairs from approximately 37.6 million to about 199,848, achieving a 99.6% reduction in the number of calls to `ST_Intersects`.
Testing reveals that the choice of H3 resolution impacts performance. At optimal resolution 3, the geo join query time dropped to 1.17 seconds, representing a 400-fold improvement over the baseline. The article emphasizes that while there will be some false positives due to the approximation in cell coverage, the final exact check ensures that no true matches are missed. This approach avoids the overhead of maintaining an index table, allowing on-the-fly indexing that adapts easily to changes in data or query structure.
Questions about this article
No questions yet.