Let's say you're building an app called "Tomato" to help people find killer Indian Restaurants within 10km (or 6.2 miles) of them.

Normally, your first instinct is to throw a standard B-Tree index on your latitude and longitude coordinates.

CREATE TABLE restaurants (

id SERIAL PRIMARY KEY,

name VARCHAR(255),