Postgresql Postgres因长查询而崩溃

Postgresql Postgres因长查询而崩溃,postgresql,postgresql-9.3,Postgresql,Postgresql 9.3,我的postgres因长时间的查询而崩溃。它位于Debian 7 64位和postgresql-9.3.2上。我使用所有默认配置。有人能建议这可能是什么问题吗?谢谢 在查询中,calc_empty_a只是返回true的空布尔函数,因此它们应该没有问题 如果我在客户端运行查询,服务器就会崩溃。日志中没有有用的信息,请参考文章末尾的错误信息 如果我运行第1部分的查询,该查询工作得很好 如果我先运行第1部分的查询,然后运行整个查询,它运行得很好 如果我更改查询,减少r个数,例如,表中只有r1到r6,删

我的postgres因长时间的查询而崩溃。它位于Debian 7 64位和postgresql-9.3.2上。我使用所有默认配置。有人能建议这可能是什么问题吗?谢谢

在查询中,calc_empty_a只是返回true的空布尔函数,因此它们应该没有问题

如果我在客户端运行查询,服务器就会崩溃。日志中没有有用的信息,请参考文章末尾的错误信息

如果我运行第1部分的查询,该查询工作得很好

如果我先运行第1部分的查询,然后运行整个查询,它运行得很好

如果我更改查询,减少r个数,例如,表中只有r1到r6,删除带有r8、r7的谓词,但保留第2部分的GROUPBY和HAVING子句。这个查询仍然运行良好

如果查询在HVING子句中有一个空函数,则查询也可以正常工作,但如果有两个函数,则查询将崩溃

下面的查询运行良好

 SELECT r1.f2 as b, r1.f1 as a , r1.e as e
 FROM r r8,r r7,r r6,r r5,r r4,r r3,r r2,r r1
 WHERE
 r1.f2=r2.f1 AND 
 r1.f2=r3.f1 AND 
 r1.f2=r4.f1 AND 
 r1.f1=r5.f2 AND 
 r1.f1=r8.f1 AND 
 r2.f1=r3.f1 AND 
 r2.f1=r4.f1 AND
 r2.f2=r6.f2 AND 
 r2.f2=r7.f1 AND 
 r3.f1=r4.f1 AND 
 r3.f2=r7.f2 AND 
 r3.f2=r8.f2 AND 
 r4.f2=r5.f1 AND 
 r4.f2=r6.f1 AND 
 r5.f1=r6.f1 AND 
 r5.f2=r8.f1 AND 
 r6.f2=r7.f1 AND 
 r7.f2=r8.f2  
 group by r1.f2,r1.f1, r1.e
 having
 calc_empty_a() AND
 calc_empty_a();
我已将操作系统设置为使用严格的过度限制模式:

sysctl -w vm.overcommit_memory=2
错误信息:

在客户端

 The connection to the server was lost. Attempting reset: Succeeded.
服务器端

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.
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.
LOG:  all server processes terminated; reinitializing
LOG:  database system was interrupted; last known up at 2014-11-07 16:47:03 GMT
LOG:  database system was not properly shut down; automatic recovery in progress
LOG:  redo starts at 0/2126C98
LOG:  record with zero length at 0/21A9D98
LOG:  redo done at 0/21A9D68
LOG:  last completed transaction was at log time 2014-11-07 16:47:26.844406+00
LOG:  autovacuum launcher started
LOG:  database system is ready to accept connections

至少,我们需要导致崩溃的查询、PostgreSQL版本号和平台以及您安装的任何扩展。您需要在日志中进一步备份。我猜根本原因很可能是OOM死机,而且您没有按照手册的建议禁用虚拟内存过度使用。您可能有一个非常高的工作记忆设置,或者正在积累大量的后触发器,或者已经发现泄漏。。。如果没有你的PostgreSQL版本,你的配置,日志中的第一个错误等等,几乎不可能说。我已经更新了更多的细节,你能不能请kindle帮我解决这个问题@克雷格:你还是砍了太多的原木。显示更多服务器日志-从第一次后端进程崩溃或之前的一点。请参阅main post@CraigRinger中的链接
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.
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.
LOG:  all server processes terminated; reinitializing
LOG:  database system was interrupted; last known up at 2014-11-07 16:47:03 GMT
LOG:  database system was not properly shut down; automatic recovery in progress
LOG:  redo starts at 0/2126C98
LOG:  record with zero length at 0/21A9D98
LOG:  redo done at 0/21A9D68
LOG:  last completed transaction was at log time 2014-11-07 16:47:26.844406+00
LOG:  autovacuum launcher started
LOG:  database system is ready to accept connections