我正在用大约80 am的数据执行一次批量复制到postgres。
\copy my_table FROM '/path/csv_file.csv' csv DELIMITER ','在提交事务之前,我会得到以下错误。
服务器意外地关闭了连接,这可能意味着服务器在处理请求之前或处理过程中异常终止。
在PostgreSQL日志中:
LOG:server process (PID 21122) was terminated by signal 9: Killed
LOG:terminating any other active server processes
WARNING:terminating connection because of crash of another server process
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.
HINT: In a moment you should be able to reconnect to the database and repeat your command. 发布于 2013-05-08 00:12:59
后端进程接收信号9 (SIGKILL)。在以下情况下可能发生这种情况:
kill -9;kill -9 (非常不安全,请不要这样做);或在后一种情况下,您将在内核的dmesg输出中看到OOM杀手活动的报告。我想这就是你在你的案子里看到的。
PostgreSQL服务器应该在没有虚拟内存过度提交的情况下配置,这样OOM杀手就不会运行,并且PostgreSQL能够处理内存不足的情况。见Linux内存过度提交的PostgreSQL文档。
另一个问题仍然是“为什么要使用这么多内存”。要解决这个问题,需要更多了解您的设置:服务器有多少内存,有多少是免费的,您的work_mem和maintenance_work_mem设置是什么,等等。在升级到当前的PostgreSQL 8.4修补程序版本之前,这不是一个非常有趣的问题,以确保问题不是已经解决的问题。
https://stackoverflow.com/questions/16418173
复制相似问题