Geo indexes
0-day streakReview

Your progress

Level 1

0 XP100 XP to level 2
0day streak
0best streak
0topics started
0cards reviewed
    Review cards

    Progress is stored only in this browser. No account is required.

    Layer 3 · Go deeper · 8 min

    Go deeper

    Size it, build it, then make the calls an interviewer will push you on.

    Back of the envelope

    Size it up

    Tap through each step of the arithmetic.

    How many index entries does “within 2 km” read on two B-trees?

      How much load do 500,000 live drivers put on Redis?

        How often does a moving driver change 6-character cell?

          4 interview moments

          You’re the candidate

          The interviewer pushes on the hard parts. Pick an approach and see how it holds up.

          1. Deep dive 1 of 4

            Interviewer

            “Assume 500,000 drivers online, each pinging every 4 seconds. Riders search within 2 km. Where do the live positions go?”

            Your move. Pick an approach:

          2. Deep dive 2 of 4

            Interviewer

            “Surge pricing compares ride requests with free drivers in each patch of a city, and each patch with its neighbours. How do you bucket them?”

            Your move. Pick an approach:

          3. Deep dive 3 of 4

            Interviewer

            “You build the grid yourself in Cassandra, with the geohash cell as partition key. How do you find drivers within 2 km of a pickup?”

            At 100 drivers per km² in the core, the matcher needs only the nearest 20.

            Your move. Pick an approach:

          4. Deep dive 4 of 4

            Interviewer

            “Your 10 million restaurants already live in PostgreSQL. How do you find the ones within 2 km of a customer?”

            Your move. Pick an approach: