The Problem We Were Actually Solving

In 2024 the Veltrix festival needed a treasure-hunt engine that could handle 12,000 concurrent players across three venues while still giving each user the illusion that their phone was whispering secrets directly to them. We thought the bottleneck would be network I/O or client rendering. We were wrong—it was the lookup query that ran every time a player tilted their phone:

SELECT treasure_box.uuid FROM treasure_box

WHERE venue_id = ? AND ST_DWithin(geom, player_location, 5)

ORDER BY RANDOM() LIMIT 1;