KNN algorithms
SQL based nearest algorithm
Select * from Places
where Latitude between X-D and X+D
and Longitude between Y-D and Y+D
-- Between queries will create large amounts of intermediate data and create high costs on servers.
-- GridID will greatly reduce the amount of intermediate data size.
select * from Places
where latitude between X-D and X+D
and longitude between Y-D and Y+D
and gridID in (gridIDx0,gridIDx1,gridIDx2,gridIDx3,gridIDx4,gridIDx5,gridIDx6,gridIDx7,gridIDx8);
Pros & Cons
Size estimation
SQL spatial datatypes

Implementation in SQL
Storage option 1: Store data as spatial data types

Storage option 2: PostgreSQL spatial query - KNN
Dynamic grids - Squad tree

Pros & Cons
Size estimation
Geohashes
Steps



Redis impl

Hilbert Curves
Last updated
Was this helpful?