When researching on how to do the classic "get POI in range" problem I've found that the most used algorithms are Haversine and if you need real accuracy then Vincenty's formula. I went the first one because high accuracy wasn't an issue. However, it got me thinking on something that hits me as odd, why is that I found no references to caching the Cartesean coordinates on the database instead of using the haversine formula with the lat/lon?
The issue here is, of course, performance. The haversine formula requires a ton of cos/sin function calls, but wouldn't it be simpler to store the projected X, Y and Z of a lat/lon point on the database and apply the dot product directly? That would require a single arccos call unless I'm mistaken.