CREATE INDEX ON stores USING GIST (location);
SELECT * FROM stores WHERE location && 'BOX(2,2 , 6,6)';
2D space — nested bounding boxes
R1
R2
p1
p2
p3
p4
p5
p6
p7
p8
Tree shape
root
R1 (bbox)
R2 (bbox)
p1
p2
p3
p4
p5
p6
p7
p8
Key difference from B-tree: R1 and R2 overlap. That\'s allowed — and why GiST can handle types with no total order.