查询语句:
SELECT g.grid_no FROM city_grid g JOIN poi p ON g.city = '北京' and p.city = '北京' and g.grid_level = 1 and p.xm_type = '住宅' AND st_dwithin(g.center, p.location, 400) GROUP BY g.grid_no HAVING count(
p.id) >= 3;
表结构如下
table city_grid 数据量 1600 万
address varchar(255),
box geography,
center geography,
city varchar(255),
grid_level integer,
grid_no integer
box gist 索引
center gist 索引
grid_no btree 索引
table poi 60 万
id serial not null constraint poi_pkey primary key,
address text,
city varchar(255),
district varchar(255),
location geography,
name varchar(255),
poi_id varchar(255),
type varchar(255),
type_code varchar(255),
xm_type varchar(255)
location gist 索引