← 📊 Data Science

🗺️ Spatial Index Lab

Total rows:
Cells searched:
Rows examined:
Rows matched:
FPS:
Drag — rotate · Scroll — zoom

🗺️ How PostGIS Turns PostgreSQL into a Spatial Query Engine

A 3D map scattered with data points sits under a spatial R-tree/GiST index grid. Draw a bounding-box query and watch the index highlight only the cells — and the rows inside them — it actually needs to search.

🔬 What It Demonstrates

PostGIS's GiST index groups geometries into bounding boxes so a query can discard whole branches of the tree at once. Amber points are candidates inside searched cells; green points are exact matches inside the query box; grey points were never touched.

🎮 How to Use

Move the query box with the X/Z sliders and resize it, then change the index granularity to see the searched-cell count shrink or grow. Hit "Compare full table scan" to see what scanning every row without an index looks like.

💡 Did You Know?

PostGIS is built on PostgreSQL's generic GiST framework — the same indexing machinery that also powers full-text search — with bounding-box splitting rules registered specifically for geometry columns.