【发布时间】:2021-04-17 10:25:54
【问题描述】:
我拥有名为 node 和 ways 的地理空间表。
我想使用空间连接将ways 表的end_node_id 列设置为node 表属性。两个表有大约 100K 的数据。
update ways
set
end_node_id = n.node_id
from
ways w
inner join
nodes n
on
st_endpoint(w.shape) = n.shape;
但是这个查询需要很多次。 15 分钟后,我停止了查询。这个操作有性能查询吗?
更新说明:
Update on ways w (cost=0.00..669909619.43 rows=24567397 width=576)
-> Nested Loop (cost=0.00..669909619.43 rows=24567397 width=576)
Join Filter: (st_endpoint(w.shape) = n.shape)
-> Seq Scan on ways w (cost=0.00..8960.61 rows=120161 width=564)
-> Materialize (cost=0.00..12200.81 rows=204454 width=52)
-> Seq Scan on nodes n (cost=0.00..9181.54 rows=204454 width=52)
【问题讨论】:
标签: sql postgresql postgis spatial spatial-query