4

我正在使用 PostgreSQL 8.4 和 PostGIS 1.5。我想要做的是从一个表插入数据到另一个(但不是严格相同的数据)。对于每一列,运行几个查询,表中总共存储了 50143 行。但是查询非常耗费资源:查询运行几分钟后,连接就会丢失。它在执行查询时发生了大约 21-22k MS,之后我必须再次手动启动 DBMS。我应该如何解决这个问题?

错误信息如下:

 [Err] server closed the connection unexpectedly
    This probably means the server terminated abnormally
    before or while processing the request.

此外,这里是 psql 错误日志:

2013-07-03 05:33:06 AZOST HINT:  In a moment you should be able to reconnect to the database and repeat your command.
2013-07-03 05:33:06 AZOST WARNING:  terminating connection because of crash of another server process
2013-07-03 05:33:06 AZOST DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
4

1 回答 1

2

我的猜测是,阅读您的问题是您遇到了内存不足的问题。Craig 关于关闭过度使用的建议是一个很好的建议。work_mem如果这是一个大查询,您可能还需要减少。这可能会减慢您的查询速度,但会释放内存。 work_mem是每个操作,因此查询可以多次使用该设置。

另一种可能性是您在 PostgreSQL 的 C 语言模块中遇到了某种错误。如果是这种情况,请尝试更新到最新版本的 PostGIS 等。

于 2013-10-29T04:14:31.460 回答