Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VcLEB-0002mV-06 for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Nov 2013 20:21:55 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VcLEA-0004Fi-G1 for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Nov 2013 20:21:54 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VcLE9-0004FZ-9Y for pgsql-hackers@postgreSQL.org; Fri, 01 Nov 2013 20:21:53 +0000 Received: from 99-153-64-76.uvs.austtx.sbcglobal.net ([99.153.64.76] helo=noel.decibel.org) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VcLE2-0001p2-43 for pgsql-hackers@postgreSQL.org; Fri, 01 Nov 2013 20:21:51 +0000 Received: from [10.10.10.40] (rrcs-97-77-122-61.sw.biz.rr.com [97.77.122.61]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by noel.decibel.org (Postfix) with ESMTPSA id BD2AF6D45D; Fri, 1 Nov 2013 20:21:43 +0000 (UTC) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) Subject: Re: [BUGS] BUG #8573: int4range memory consumption From: Jim Nasby In-Reply-To: <18832.1383332908@sss.pgh.pa.us> Date: Fri, 1 Nov 2013 15:21:43 -0500 Cc: g.vanluffelen@qipc.com, pgsql-hackers@postgreSQL.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <18832.1383332908@sss.pgh.pa.us> To: Tom Lane X-Mailer: Apple Mail (2.1510) X-Pg-Spam-Score: -0.9 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On Nov 1, 2013, at 2:08 PM, Tom Lane wrote: > g.vanluffelen@qipc.com writes: >> int4range ( and any other range function) consumes much memory when used= in >> a select statement on a big table. >=20 > The problem is that range_out leaks memory, as a consequence of creating a > number of intermediate strings that it doesn't bother to free. I don't > believe it's the only output function that leaks memory, but it does > so with particular vim: now that we've increased the initial size of > StringInfo buffers, it's probably wasting upwards of 2K per call. >=20 > While we could doubtless hack range_out to release those strings again, > it seems to me that that's just sticking a finger in the dike. I'm > inclined to think that we really ought to solve this class of problems > once and for all by fixing printtup.c to run the output functions in a > temporary memory context, ... > we're already using a reset-per-row approach to memory management of > output function calls in COPY OUT, and I know for a fact that we've > squeezed that code path as hard as we could. +1. COPY is actually the case I was worried about=85 if you're dealing with= large amounts of data in other clients ISTM that other things will bottlen= eck before the extra memory context. --=20 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers