2
我想比较并创建一个新表。但它需要更多时间来比较。比较几何时缓慢的查询
表1(模式)
+-------------+----------+-------------+
| Column | Type | Modifiers |
|-------------+----------+-------------|
| line_id | bigint | |
| junction | integer | |
| geom | geometry | |
+-------------+----------+-------------+
Indexes:
"points_geom_gix" gist (geom)
凡结包含0或1。
表2
+----------+----------+-------------+
| Column | Type | Modifiers |
|----------+----------+-------------|
| line_id | bigint | |
| geom | geometry | |
+----------+----------+-------------+
Indexes:
"jxn_geom_gix" gist (geom)
我想通过比较几何形状以创建一个新的表表3两张桌子。
条件
- 两个表中的其中两个几何相等选择GEOM。
- 从表1,其中结= 1和和的geom不存在选择的geom在 表3.
我试图像下面
CREATE TABLE table3 as select a.geom from table1 a, table2 b where st_equals(a.geom,b.geom);
(表3上的的geom列创建要旨指数)
和
INSERT INTO table3 SELECT a.geom from table1 a, table3 b where a.junction = 1 and NOT st_equals(a.geom,b.geom);
但第二Q-尤里需要很多时间。
有人可以帮助我优化查询吗?