DEV Community
•
2026-04-20 16:18
greatCircleDistance in ClickHouse: Avoiding Full Table Scans
When working with location data, one problem shows up almost immediately:
“How do I calculate the distance between two coordinates stored in my database?”
At first, it seems like something you’d have to handle outside the database.
But if you're using ClickHouse, there’s a built-in function for this.
The Right Tool: greatCircleDistance
greatCircleDistance(lat1, lon1, lat2, l...