Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 3764C1FA2A4B for ; Thu, 26 Jul 2012 05:17:45 -0300 (ADT) Received: from mail-pb0-f46.google.com ([209.85.160.46]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SuJGP-0003sD-Fw for pgsql-bugs@postgresql.org; Thu, 26 Jul 2012 08:17:44 +0000 Received: by pbbrp8 with SMTP id rp8so2852801pbb.19 for ; Thu, 26 Jul 2012 01:17:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=LRmfe4mR07tBERw1lRL8KyFZadFObqhuNQHBeJNwbTw=; b=bTeLuSsZOImtBDTQMj2t4Vct7HGk8SksMMW3obdrErKfc34SXGBxALqZ3AqmGQ6tWl UCydM5ItV4Rm2taOM33BEXaZHTaK8CTYhen47CDawctcOmy4CgCFv0a0lc72bbzHHobL GIeu/z6so0BfbdVop2vahPQyNTe6cQP9vM2b/Ogmt7oU7ZUGLhiYreNdUwkFOT3lwy/w Sy7RTfc2flXhHqOZHK0MrkRaJzhPkaqsbQpRSSG5liJfMrxZyDi92htSoT1a6OHhaoN6 Onlfdax2QQbHxP5yMtpEL3gUO4orvDUhfsxZxvCSGh9mPu0lfXAqDqt9SKEwMZa7lCAH B4QA== Received: by 10.68.213.225 with SMTP id nv1mr3033427pbc.89.1343290646695; Thu, 26 Jul 2012 01:17:26 -0700 (PDT) Received: from ayaki.localdomain (office1.postnewspapers.com.au. [150.101.171.128]) by mx.google.com with ESMTPS id pf8sm16088651pbc.44.2012.07.26.01.17.22 (version=SSLv3 cipher=OTHER); Thu, 26 Jul 2012 01:17:25 -0700 (PDT) Message-ID: <5010FD0F.4020400@ringerc.id.au> Date: Thu, 26 Jul 2012 16:17:19 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0 MIME-Version: 1.0 To: karavelov@mail.bg CC: pgsql-bugs@postgresql.org Subject: Re: BUG #6763: Severe memory leak with arrays and hstore References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQm+eZ/Ctykpg+c68cpCpfDsbUwHVVZp6QGhmzEUL88tfsB5hQvd7Mbz/ACJojVRdhp7RCN7 X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201207/205 X-Sequence-Number: 33681 On 07/26/2012 09:32 AM, karavelov@mail.bg wrote: > Finally I have managed to migrate it in batches of 100-200k user ids and > disconnecting after each query in order to free the backend and leaked > memory. If you do it in batches, but you do NOT disconnect and reconnect, does the backend continue to grow? What's the output of: SELECT count(sub.user_id), to_char(AVG(sub.n_prefs), '99999.99') FROM ( SELECT user_id, count(name) AS n_prefs FROM old_prefs GROUP BY user_id) AS sub; and SELECT pg_size_pretty(pg_total_relation_size('old_prefs')); ? -- Craig Ringer