数据库是 postgresql,以前经纬度用的单独字段,现在像用 point 类型再加 postgis 做分析。表有优化,相当于做了表分区,现在 sql 是
update t_gps
set location = ST_GeomFromText('Point(' || "lont" || ' ' || "lat" || ')', 4326);
create index idx_gps_location on t_gps using gist ("location");
但在测试库试了下,真的很慢。一般这种更新方案怎么做比较好?
1
nandaye 2020-01-13 11:46:45 +08:00 1
create table test as select t_gps.*,ST_GeomFromText('Point(' || "lont" || ' ' || "lat" || ')', 4326) as location from t_gps;
drot table t_gps; rename test to t_gps; |
4
duhui 2020-01-14 09:40:32 +08:00
drot table t_gps; 改成 rename t_gps to t_gps_bak; 比较好吧
|