Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Y1HvG-00011v-6U for pgsql-performance@arkaria.postgresql.org; Wed, 17 Dec 2014 16:58:02 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Y1HvF-0006b8-Nt for pgsql-performance@arkaria.postgresql.org; Wed, 17 Dec 2014 16:58:01 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Y1HvE-0006ax-Hk for pgsql-performance@postgresql.org; Wed, 17 Dec 2014 16:58:00 +0000 Received: from smtp1.oma.be ([193.190.144.13]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1Y1Hv7-0007js-Pd for pgsql-performance@postgresql.org; Wed, 17 Dec 2014 16:57:58 +0000 Received: from snow.oma.be (snow.oma.be [193.190.249.132]) by smtp1.oma.be (8.14.3/8.14.3/SuSE Linux 0.8) with ESMTP id sBHGvpI8006900 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 17 Dec 2014 16:57:51 GMT From: Alessandro Ipe To: Torsten Zuehlsdorff Cc: pgsql-performance@postgresql.org Subject: Re: Excessive memory used for INSERT Date: Wed, 17 Dec 2014 17:57:51 +0100 Message-ID: <35486133.28l5a59Zd7@snow.oma.be> Organization: Royal Meteorological Institute of Belgium User-Agent: KMail/4.14.3 (Linux/3.7.10-1.1-desktop; KDE/4.14.3; x86_64; ; ) In-Reply-To: <5491A0A8.7010506@toco-domains.de> References: <2163931.4eVnXNjHa3@snow.oma.be> <5491A0A8.7010506@toco-domains.de> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="iso-8859-15" X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Hi Torsten, Thanks for your answer. I have modified (SELECT * FROM upsert) to (SELECT * FROM upsert WHERE slot=to_timestamp('201212032145', 'YYYYMMDDHH24MI') and MSG=2) according to your suggestion to reduce the result-set to a single row. However, the INSERT process is still consuming the same amount of RAM. Regards, Alessandro. On Wednesday 17 December 2014 16:26:32 Torsten Zuehlsdorff wrote: > Hello Alessandro, > > > 2014-12-15 17:54:07 GMT DETAIL: Failed process was running: WITH upsert > > AS (update MSG set > > (slot,MSG,HRV,VIS006,VIS008,IR_016,IR_039,WV_062,WV_073,IR_087,IR_097,IR_1 > > 08,IR_120,IR_134,PRO,EPI,CLM,TAPE) = (to_timestamp('201212032145', > > 'YYYYMMDDHH24MI'),2,'\xffffff','\xff','\xff','\xff','\xff','\xff','\xff',' > > \xff','\xff','\xff','\xff','\xff','\x01','\x01','\x7f','LTO5_020') where > > slot=to_timestamp('201212032145', 'YYYYMMDDHH24MI') and MSG=2 RETURNING > > *) insert into MSG > > (slot,MSG,HRV,VIS006,VIS008,IR_016,IR_039,WV_062,WV_073,IR_087,IR_097,IR_1 > > 08,IR_120,IR_134,PRO,EPI,CLM,TAPE) select to_timestamp('201212032145', > > 'YYYYMMDDHH24MI'),2,'\xffffff','\xff','\xff','\xff','\xff','\xff','\xff',' > > \xff','\xff','\xff','\xff','\xff','\x01','\x01','\x7f','LTO5_020' WHERE > > NOT EXISTS (SELECT * FROM upsert); > > How many rows is "(SELECT * FROM upsert)" returning? Without knowing > more i would guess, that the result-set is very big and that could be > the reason for the memory usage. > > I would add an WHERE clause to reduce the result-set (an correct index > can fasten this method even more). > > Greetings, > Torsten -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance