Sql 使用NULL而不是0更新表将终止与服务器的连接

Sql 使用NULL而不是0更新表将终止与服务器的连接,sql,postgresql,null,sql-update,Sql,Postgresql,Null,Sql Update,在macOS 14.5上的PostgreSQL 12.1中,我试图在一个大约2.5亿行的表中用NULL替换零。大约有800万行需要更新。该表没有外键、私钥或触发器等。运行时: UPDATE table SET column = NULL WHERE column = 0; 与服务器的连接被服务器进程(PID xxx)终止,信号9:killed:9,我理解这可能是一个OOM问题 我删除了表中的所有索引,这将“cost”(运行EXPLAIN)从7位降到了0.00,但是命令仍然不起作用。我用的是一台

在macOS 14.5上的PostgreSQL 12.1中,我试图在一个大约2.5亿行的表中用NULL替换零。大约有800万行需要更新。该表没有外键、私钥或触发器等。运行时:

UPDATE table
SET column = NULL
WHERE column = 0;
与服务器的连接被
服务器进程(PID xxx)终止,信号9:killed:9
,我理解这可能是一个OOM问题

我删除了表中的所有索引,这将“cost”(运行
EXPLAIN
)从7位降到了0.00,但是命令仍然不起作用。我用的是一台16gb内存的家用笔记本电脑

运行命令(删除索引)的日志为:


如何更新表?谢谢

日志文件里有什么消息吗?你的确切版本是什么?(
select version();
会告诉您)。您有正在运行的复制吗?谢谢您的评论。我用日志输出和postgres版本更新了这个问题。我正在运行12.1。表是否有触发器或外键约束?不,没有外键或触发器。也没有私钥。您在哪个操作系统上运行?
2020-02-17 09:31:08.626 CET [94908] LOG:  server process (PID xxx) was terminated by signal 9: Killed: 9
2020-02-17 09:31:08.626 CET [94908] DETAIL:  Failed process was running: update tablename
        set columnname = NULL
        where columnname = 0;

2020-02-17 09:31:08.626 CET [94908] LOG:  terminating any other active server processes
2020-02-17 09:31:08.626 CET [94919] WARNING:  terminating connection because of crash of another server process
2020-02-17 09:31:08.626 CET [94919] DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exi$
2020-02-17 09:31:08.626 CET [94919] HINT:  In a moment you should be able to reconnect to the database and repeat your command.
2020-02-17 09:31:08.626 CET [94914] WARNING:  terminating connection because of crash of another server process
2020-02-17 09:31:08.626 CET [94914] DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exi$
2020-02-17 09:31:08.626 CET [94914] HINT:  In a moment you should be able to reconnect to the database and repeat your command.
2020-02-17 09:31:08.629 CET [94908] LOG:  all server processes terminated; reinitializing
2020-02-17 09:31:08.698 CET [94927] LOG:  database system was interrupted; last known up at 2020-02-17 09:30:57 CET
2020-02-17 09:31:08.901 CET [94927] LOG:  database system was not properly shut down; automatic recovery in progress
2020-02-17 09:31:08.906 CET [94927] LOG:  invalid record length at 17/894C438: wanted 24, got 0
2020-02-17 09:31:08.906 CET [94927] LOG:  redo is not required