2013-07-03 53 views
2

我使用的是PostgreSQL 8.4和PostGIS 1.5。我試圖做的是從一個表插入數據到另一個(但不是嚴格相同的數據)。對於每一列,都會運行一些查詢,並且表中存儲了總共50143行。但是查詢的資源相當繁重:查詢運行幾分鐘後,連接丟失。它發生大約21-22k MS執行查詢,之後我必須再次手動啓動DBMS。我應該如何着手解決這個問題?查詢在PostgreSQL中運行幾分鐘後連接丟失

錯誤消息如下:

[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. 
+0

檢查PostgreSQL日誌以瞭解任何相關內容。 –

+0

我已更新該問題。 –

+0

在日誌中比這更進一步,這是真正的錯誤的後果。另外,使用'{}'(四個空格縮進)按鈕,以便日誌不被換行。 –

回答

0

我的猜測,閱讀你的問題,是你打出來的內存問題。克雷格關於過度使用的建議是一個不錯的選擇。如果這是一個大問題,您可能還需要減少work_mem。這可能會降低查詢速度,但會釋放內存。 work_mem是每個操作,因此查詢可以使用該設置的許多倍。

另一種可能性是你在PostgreSQL的C語言模塊中遇到某種錯誤。如果是這種情況,請嘗試更新到最新版本的PostGIS等。