From: Rae Stiening <stiening@comcast.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #8013: Memory leak
Date: Sun, 31 Mar 2013 15:59:39 -0400
Message-ID: <FDF3405F-45DB-434B-8764-757F563DFDB2@comcast.net> (raw)
In-Reply-To: <12427.1364750172@sss.pgh.pa.us>
References: <E1ULwLX-0007BV-Mz@wrigleys.postgresql.org>
<12427.1364750172@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
I found that by replacing the postgresql.conf file with the original that is present following an initdb the query ran without a memory problem. I looked at the "bad" configuration file and couldn't see anything wrong with it. I regret that because of a typing error the bad file was accidentally deleted. I have subsequently been unable to reproduce the bad behavior. After editing the original file to be the same as what I had intended for the erased file the query still ran without a problem. Memory usage topped out at about 2.1 GB. Even setting work_mem and maintenance_work_mem to 30000MB did not change the maximum memory usage during the query.
Regards,
Rae Stiening
On Mar 31, 2013, at 1:16 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> stiening@comcast.net writes:
>> The query:
>> SELECT pts_key,count(*)
>> FROM tm_tm_pairs GROUP BY pts_key HAVING count(*) !=1 ORDER BY
>> pts_key
>
>> Which is executed as:
>> GroupAggregate (cost=108680937.80..119278286.60 rows=470993280 width=4)
>> Filter: (count(*) <> 1)
>> -> Sort (cost=108680937.80..109858421.00 rows=470993280 width=4)
>> Sort Key: pts_key
>> -> Seq Scan on tm_tm_pairs (cost=0.00..8634876.80 rows=470993280
>> width=4)
>
>> uses all available memory (32GB). pts_key is an integer and the table
>> contains about 500 million rows.
>
> That query plan doesn't look like it should produce any undue memory
> consumption on the server side. How many distinct values of pts_key are
> there, and what are you using to collect the query result client-side?
> psql, for instance, would try to absorb the whole query result
> in-memory, so there'd be a lot of memory consumed by psql if there are
> a lot of pts_key values. (You can set FETCH_COUNT to alleviate that.)
>
> A different line of thought is that you might have set work_mem to
> an unreasonably large value --- the sort step will happily try to
> consume work_mem worth of memory.
>
> regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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: stiening@comcast.net, tgl@sss.pgh.pa.us
Subject: Re: BUG #8013: Memory leak
In-Reply-To: <FDF3405F-45DB-434B-8764-757F563DFDB2@comcast.net>
References: <E1ULwLX-0007BV-Mz@wrigleys.postgresql.org> <12427.1364750172@sss.pgh.pa.us> <FDF3405F-45DB-434B-8764-757F563DFDB2@comcast.net>
* 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