Skip to main content
This guide covers everything you need to know about configuring geospatial indexes in Apache Pinot for optimal spatial query performance.

Overview

Apache Pinot uses H3 (Hierarchical Hexagons) indexing system for geospatial operations. H3 divides the Earth’s surface into hexagonal cells at multiple resolution levels, enabling fast spatial filtering before applying precise geospatial calculations.

H3 Indexing Benefits

  • Fast spatial filtering using hexagonal grids
  • Configurable precision with H3 resolution levels
  • Hierarchical structure for efficient range queries
  • 10-100x performance improvement over non-indexed queries

Configuration Steps

  1. Define geospatial column as BYTES in schema
  2. Add transform function for data conversion
  3. Configure H3 index with appropriate resolutions
  4. Disable dictionary encoding (use RAW)

H3 Resolution Levels

Understanding H3 resolution levels is crucial for optimal configuration:

Resolution to Precision Mapping

Resolution Selection Guidelines

Global Applications (0-4)
  • Cross-country logistics
  • International commerce
  • Climate/weather analysis
Regional Applications (5-8)
  • City-wide services
  • Delivery optimization
  • Urban planning
Local Applications (9-12)
  • Store locators
  • Asset tracking
  • Navigation systems
Precision Applications (13-15)
  • Indoor positioning
  • IoT sensors
  • Robotics/automation

Basic Configuration

Step 1: Schema Configuration

Define your geospatial column in the table schema:

Step 2: Table Configuration

Configure the H3 index in your table config:

Advanced Configuration Examples

Single Resolution Strategy

Configure a single H3 resolution appropriate for your query patterns:
Why Single Resolution? The H3 index operators (H3IndexFilterOperator and H3InclusionIndexFilterOperator) use only the lowest (most coarse-grained) resolution from your configuration. Multiple resolutions provide no performance benefit and may increase storage overhead unnecessarily. Distance vs Resolution Matching: Choose your resolution based on typical query distances. If your query distance is >100x the hexagon edge length, the index will automatically revert to full scan. Example:
  • Resolution 8 (hex edge ~461m): Good for queries up to ~46km
  • Resolution 5 (hex edge ~8.2km): Good for queries up to ~820km
  • Resolution 11 (hex edge ~65m): Good for queries up to ~6.5km

Legacy Configuration Format

The older configuration format is still supported:
Note: In legacy format, use “resolutions” as a string. In the current format, use “resolution” as an array.

Transform Function Options

Basic Point Creation

From Existing WKT Data

From GeoJSON Data

Conditional Transform Functions

Real-World Configuration Examples

Ride-Sharing Service

Table Config:

Retail Store Locator

Table Config:

IoT Sensor Network

Table Config:

Configuration Best Practices

Required Configuration

  1. Disable dictionary encoding with "encodingType": "RAW" (required for H3 index to work)
  2. Add to noDictionaryColumns in tableIndexConfig (achieves the same as above - can use both for safety)
  3. Use BYTES data type for geospatial columns in schema
  4. Choose single resolution appropriate for your query patterns (only lowest resolution is used by index operators)

Common Configuration Errors

  1. Using “resolutions” instead of “resolution” in current config format - will cause indexer to fail
  2. Forgetting RAW encoding - index won’t work with dictionary encoding
  3. Using multiple resolutions - only the lowest resolution is used, others waste storage
  4. Wrong data type - must use BYTES, not STRING for geospatial columns
  5. Resolution too high for query distances - when query distance is >100x the hexagon size, index is bypassed and reverts to full scan

Validation and Testing

Verify Index Creation

Check if your index was created successfully:
Look for these operators in the query plan:
  • FILTER_H3_INDEX - Index is being used for ST_Distance
  • INCLUSION_FILTER_H3_INDEX - Index is being used for ST_Within/ST_Contains

Test Query Performance

Monitor Index Effectiveness

Migration from Non-Indexed Tables

Adding Index to Existing Table

  1. Update table configuration:
  1. Reload table configuration:
  1. Refresh/rebuild segments to apply the new index