Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql Postgres无效内存分配请求大小1073741824_Sql_Postgresql_Postgis_Postgresql 9.6 - Fatal编程技术网

Sql Postgres无效内存分配请求大小1073741824

Sql Postgres无效内存分配请求大小1073741824,sql,postgresql,postgis,postgresql-9.6,Sql,Postgresql,Postgis,Postgresql 9.6,当我运行长时间查询[1]以根据子查询的结果更新几何体列时,我得到以下错误“无效内存分配请求大小1073741824” 有人知道如何修正这个错误吗?或者如何修改更新查询以更好地生成几何体 [1] 以下是查询计划: Update on hp (cost=133655367.27..139530992.38 rows=1 width=268) -> Nested Loop (cost=133655367.27..139530992.38 rows=1 width=268)

当我运行长时间查询[1]以根据子查询的结果更新几何体列时,我得到以下错误“无效内存分配请求大小1073741824”

有人知道如何修正这个错误吗?或者如何修改更新查询以更好地生成几何体

[1]

以下是查询计划:

Update on hp  (cost=133655367.27..139530992.38 rows=1 width=268)
  ->  Nested Loop  (cost=133655367.27..139530992.38 rows=1 width=268)
        ->  Subquery Scan on lines  (cost=133655366.69..139529271.88 rows=200 width=104)
              ->  GroupAggregate  (cost=133655366.69..139529269.88 rows=200 width=40)
                    Group Key: sbp.hp_id
                    ->  GroupAggregate  (cost=133655366.69..139510248.44 rows=1267929 width=40)
                          Group Key: sbp.hp_id
                          ->  Sort  (cost=133655366.69..134489514.21 rows=333659008 width=48)
                                Sort Key: sbp.hp_id, sbp.poradove_cislo_bodu
                                ->  Hash Join  (cost=7282892.98..76155670.90 rows=333659008 width=48)
                                      Hash Cond: (sbp.bp_id = sobr.id)
                                      ->  Seq Scan on sbp  (cost=0.00..8104984.08 rows=333659008 width=24)
                                      ->  Hash  (cost=4761304.88..4761304.88 rows=124139688 width=40)
                                            ->  Seq Scan on sobr  (cost=0.00..4761304.88 rows=124139688 width=40)
        ->  Index Scan using hp_id_key on hp  (cost=0.57..8.59 rows=1 width=172)
              Index Cond: (id = lines.hp_id)
              Filter: (the_geom IS NULL)

谢谢你的建议

我认为您正在采取不必要的措施,我会尝试:

SET the_geom = lines.the_geom 
FROM (
    SELECT sbp.hp_id,
    st_makeline(sobr.the_geom ORDER BY hp_id, point_sequence) as the_geom
    FROM sbp 
    JOIN sobr 
    ON sbp.bp_id=sobr.id
    GROUP BY hp_id
    ) lines
WHERE lines.hp_id = hp.id AND hp.the_geom IS NULL;

但是如果没有样本数据,我不能100%肯定它会起作用

谢谢!它似乎工作正常,速度更快!
SET the_geom = lines.the_geom 
FROM (
    SELECT sbp.hp_id,
    st_makeline(sobr.the_geom ORDER BY hp_id, point_sequence) as the_geom
    FROM sbp 
    JOIN sobr 
    ON sbp.bp_id=sobr.id
    GROUP BY hp_id
    ) lines
WHERE lines.hp_id = hp.id AND hp.the_geom IS NULL;