我有 5 张桌子:
- users - information about user with current location_id (fk to geo_location_data)
- geo_location_data - information about location, with PostGIS geography(POINT, 4326) column
- user_friends - relationships between users.
我想为当前用户找到附近的朋友,但是执行选择查询需要花费大量时间才能知道用户是否是朋友,然后执行 select using ST_DWithin
。域模型或查询中可能有问题?