pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jim Nasby <decibel@decibel.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: g.vanluffelen@qipc.com
Cc: pgsql-hackers@postgreSQL.org
Subject: Re: [BUGS] BUG #8573: int4range memory consumption
Date: Fri, 1 Nov 2013 15:21:43 -0500
Message-ID: <FE8DFBB6-CE61-45FE-BCFE-34E3941D1D37@decibel.org> (raw)
In-Reply-To: <18832.1383332908@sss.pgh.pa.us>
References: <E1VcC7Y-0006Tl-He@wrigleys.postgresql.org>
	<18832.1383332908@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

On Nov 1, 2013, at 2:08 PM, Tom Lane <tgl@sss.pgh.pa.us> 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.
> 
> 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.
> 
> 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… if you're dealing with large amounts of data in other clients ISTM that other things will bottleneck before the extra memory context.

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (12+ messages)  latest in thread

Message-ID: <FE8DFBB6-CE61-45FE-BCFE-34E3941D1D37@decibel.org>
Permalink:  ../FE8DFBB6-CE61-45FE-BCFE-34E3941D1D37@decibel.org/
Also on:    postgresql.org/message-id/FE8DFBB6-CE61-45FE-BCFE-34E3941D1D37@decibel.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: decibel@decibel.org, tgl@sss.pgh.pa.us, g.vanluffelen@qipc.com, pgsql-hackers@postgreSQL.org
  Subject: Re: [BUGS] BUG #8573: int4range memory consumption
  In-Reply-To: <FE8DFBB6-CE61-45FE-BCFE-34E3941D1D37@decibel.org>
  References: <E1VcC7Y-0006Tl-He@wrigleys.postgresql.org> <18832.1383332908@sss.pgh.pa.us> <FE8DFBB6-CE61-45FE-BCFE-34E3941D1D37@decibel.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox