Index the two shapes geolite_locations is actually queried by

Performancekamo-shared-library
Shipped
August 21, 2026 at 1:36 AM UTC
Author
Kamo
Commit
256ac46

Country alone was the only index on an 80,429-row table, and neither real query used it well. Measured on production: city resolution (country + subdivision), US + CA: index-scanned all 18,870 US rows to keep 984 — 138 ms country picker (SELECT DISTINCT country_iso_code, country_name): sequential scan of all 80,429 rows to return 251 — 168 ms (country_iso_code, subdivision1_iso_code) seeks straight to the state's rows; (country_iso_code, country_name) lets the picker resolve without touching the table. Extra indexes are close to free here: this table is replaced wholesale by the weekly GeoLite sync and never written on a request path, so there is no write amplification to trade against.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing