Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1a6Gh4-0001Fq-1V for pgsql-jdbc@arkaria.postgresql.org; Tue, 08 Dec 2015 11:44:30 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1a6Gh3-00050q-KU for pgsql-jdbc@arkaria.postgresql.org; Tue, 08 Dec 2015 11:44:29 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1a6G8J-0006mz-FH for pgsql-jdbc@postgresql.org; Tue, 08 Dec 2015 11:08:35 +0000 Received: from mx01.clickware.de ([78.35.13.85]) by magus.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1a6G8G-0002ZQ-DW for pgsql-jdbc@postgresql.org; Tue, 08 Dec 2015 11:08:35 +0000 Received: (qmail 4148 invoked by uid 1010); 8 Dec 2015 10:37:36 -0000 Received: from localhost (gbruensing@localhost) by mx01 (envelope-from , uid 1002) with qmail-scanner-2.06st (sophie: //. spamassassin: 3.2.3. Clear:RC:0(127.0.0.1):SA:0(-3.7/5.0):. Processed in 0.111678 secs); 08 Dec 2015 10:37:36 -0000 X-Spam-Status: No, hits=-3.7 required=5.0 Received: from localhost (HELO ?192.168.1.149?) (gbruensing@127.0.0.1) by mx01.clickware.de with SMTP; 8 Dec 2015 10:37:35 -0000 To: pgsql-jdbc@postgresql.org From: =?UTF-8?Q?Georg_Br=c3=bcnsing?= Subject: jdbc high memory consumption for RAISE NOTICE output using function-call in Java Message-ID: <5666B2EF.4030005@clickware.de> Date: Tue, 8 Dec 2015 11:37:35 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------000104010705010500090809" X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org This is a multi-part message in MIME format. --------------000104010705010500090809 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit The function creates ~16MB output. The VM needs ~200MB over statement.executeQuery(...). CREATE OR REPLACE FUNCTION Test_Grosse_Logdatei() returns INTEGER AS $$ DECLARE BEGIN FOR i IN 1..150000 LOOP RAISE notice '123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 '; END LOOP; RETURN 0; END; $$ language plpgsql; How can we reduce this? Georg Brünsing postgresql-9.4-1206-jdbc4.jar + postgresql-9.1-902.jdbc4.jar psql (PostgreSQL) 9.3.1 Java(TM) SE Runtime Environment (build 1.8.0_66-b18) + Java(TM) SE Runtime Environment (build 1.7.0_75-b13) + Java(TM) SE Runtime Environment (build pxa6460sr7-20091215_02(SR7)) JDK 6-8 Windows/Linux --------------000104010705010500090809 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit The function creates ~16MB output. The VM needs ~200MB over statement.executeQuery(...).

CREATE OR REPLACE FUNCTION Test_Grosse_Logdatei() returns INTEGER AS
$$
DECLARE
BEGIN
    FOR i IN 1..150000 LOOP
        RAISE notice '123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 ';
    END LOOP;   
   
    RETURN 0;
END;
$$
language plpgsql;

How can we reduce this?

Georg Brünsing

postgresql-9.4-1206-jdbc4.jar + postgresql-9.1-902.jdbc4.jar
psql (PostgreSQL) 9.3.1
Java(TM) SE Runtime Environment (build 1.8.0_66-b18) + Java(TM) SE Runtime Environment (build 1.7.0_75-b13) + Java(TM) SE Runtime Environment (build pxa6460sr7-20091215_02(SR7))
JDK 6-8
Windows/Linux


--------------000104010705010500090809--