Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VRNfn-0006Ae-BA for pgsql-admin@arkaria.postgresql.org; Wed, 02 Oct 2013 14:45:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VRNfm-0001NL-Le for pgsql-admin@arkaria.postgresql.org; Wed, 02 Oct 2013 14:45:06 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VRNfl-0001NA-F6 for pgsql-admin@postgresql.org; Wed, 02 Oct 2013 14:45:05 +0000 Received: from mail.iqbuzz.ru ([95.163.96.206]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VRNfd-0003JE-AK for pgsql-admin@postgresql.org; Wed, 02 Oct 2013 14:45:04 +0000 Received: by mail.iqbuzz.ru (Postfix, from userid 5001) id CE1C9C0B9E; Wed, 2 Oct 2013 18:44:21 +0400 (MSK) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bz-mail X-Spam-Level: X-Spam-Status: No, score=-0.4 required=5.0 tests=ALL_TRUSTED,URIBL_SBL autolearn=no version=3.3.1 Received: from [192.168.1.68] (proxy.iqmen.ru [195.210.159.34]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: klochkov@iqbuzz.ru) by mail.iqbuzz.ru (Postfix) with ESMTPSA id 83552C0B87; Wed, 2 Oct 2013 18:44:21 +0400 (MSK) Message-ID: <524C3163.1050502@iqbuzz.ru> Date: Wed, 02 Oct 2013 18:44:51 +0400 From: Sergey Klochkov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: pgsql-admin@postgresql.org, alejandrob@pasteleros.org.ar Subject: Re: PostgreSQL 9.2 - pg_dump out of memory when backuping a database with 300000000 large objects References: <524A90D1.5000109@iqbuzz.ru> <524B22C7.2010300@pasteleros.org.ar> In-Reply-To: <524B22C7.2010300@pasteleros.org.ar> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -0.9 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org I tried it out. It did not make any difference. On 01.10.2013 23:30, Alejandro Brust wrote: > Did U perform any vacuumdb / reindexdb before the Pg_dump? > > > El 01/10/2013 09:49, Magnus Hagander escribió: >> On Tue, Oct 1, 2013 at 11:07 AM, Sergey Klochkov wrote: >>> Hello All, >>> >>> While trying to backup a database of relatively modest size (160 Gb) I ran >>> into the following issue: >>> >>> When I run >>> $ pg_dump -f /path/to/mydb.dmp -C -Z 9 mydb >>> >>> File /path/to/mydb.dmp does not appear (yes, I've checked permissions and so >>> on). pg_dump just begins to consume memory until it eats up all avaliable >>> RAM (96 Gb total on server, >64 Gb available) and is killed by the oom >>> killer. >>> >>> According to pg_stat_activity, pg_dump runs the following query >>> >>> SELECT oid, (SELECT rolname FROM pg_catalog.pg_roles WHERE oid = lomowner) >>> AS rolname, lomacl FROM pg_largeobject_metadata >>> >>> until it is killed. >>> >>> strace shows that pg_dump is constantly reading a large amount of data from >>> a UNIX socket. I suspect that it is the result of the above query. >>> >>> There are >300000000 large objects in the database. Please don't ask me why. >>> >>> I tried googling on this, and found mentions of pg_dump being killed by oom >>> killer, but I failed to find anything related to the huge large objects >>> number. >>> >>> Is there any method of working around this issue? >> I think this problem comes from the fact that pg_dump treats each >> large object as it's own item. See getBlobs() which allocates a >> BlobInfo struct for each LO (and a DumpableObject if there are any, >> but that's just one). >> >> I assume the query (from that file): >> SELECT oid, lomacl FROM pg_largeobject_metadata >> >> returns 300000000 rows, which are then looped over? >> >> I ran into a similar issue a few years ago with a client using a >> 32-bit version of pg_dump, and got it worked around by moving to >> 64-bit. Did unfortunately not have time to look at the underlying >> issue. >> >> > > -- Sergey Klochkov klochkov@iqbuzz.ru -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin