System design · Patterns: the problems hiding inside most prompts

Proximity search: finding what is nearby

"Show me what is near me" is a range query in two dimensions, which an ordinary index handles badly, so the real design choice is how to turn location into something an index can range-scan (a geohash, a quadtree, an S2 or H3 cell) and whether the things you are searching for sit still or move every few seconds.

22 min read Full lesson in the app Patterns: geohash, quadtree, geo index, moving objects in memory

What you'll be able to do

Before this: back-of-the-envelope, picking-a-datastore

Log in to read the rest of this lesson

"Show me what is near me" is a range query in two dimensions, which an ordinary index handles badly, so the real design choice is how to turn location into something an index can range-scan (a geohash, a quadtree, an S2 or H3 cell) and whether the things you are searching for sit still or move every few seconds. This walkthrough runs about 22 minutes, with runnable code you can edit and re-run as you read. A new account gets 7 days of Pro free, no card required.

Log in to continue

The first module of every track is free to read on the web: see what's open in System design.