From: Tom Lane <tgl@sss.pgh.pa.us>
To: Mate Varga <m@matevarga.net>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: pg_upgrade with large pg_largeobject table
Date: Tue, 14 Aug 2018 13:58:01 -0400
Message-ID: <6945.1534269481@sss.pgh.pa.us> (raw)
In-Reply-To: <CAK4GaZ551DKU=W4fuWYS1cgwftMT-jy7oBZsX65rCfbazDARVA@mail.gmail.com>
References: <CAK4GaZ551DKU=W4fuWYS1cgwftMT-jy7oBZsX65rCfbazDARVA@mail.gmail.com>
Mate Varga <m@matevarga.net> writes:
> We have a PSQL 9.5 DB with 16G physical RAM and ~ 1 TB data mostly stored
> in the pg_largeobject system table. This table has 250M rows at the moment.
You mean 250M rows in pg_largeobject itself, or 250M large objects
(that is, 250M rows in pg_largeobject_metadata)?
> This command
> fails because of an OOM. Logs say:
> pg_dump: [archiver (db)] query failed: out of memory for query result
> pg_dump: [archiver (db)] query was: SELECT oid, (SELECT rolname FROM
> pg_catalog.pg_roles WHERE oid = lomowner) AS rolname, lomacl, NULL AS
> rlomacl, NULL AS initlomacl, NULL AS initrlomacl FROM
> pg_largeobject_metadata
The selected rows shouldn't be very wide here, so I'm a bit surprised
you are hitting OOM, even if there are 250M rows to read. Are you sure
you're using a 64-bit build of pg_dump?
> Would it help if we'd inline these largeobjects as e.g. text cols (instead
> of storing them as lobs)?
Yes, because then they'd not have their own ownership and permissions
for pg_dump to keep track of. (You might want bytea instead of text,
depending on what the data is.)
Using the large-object API for things that tend to not actually be very
large (which they aren't, if you've got hundreds of millions of 'em)
is an antipattern, I'm afraid. You could get away with it before we
added per-largeobject permissions, but now it's a problem for pg_dump.
regards, tom lane
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-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, m@matevarga.net
Subject: Re: pg_upgrade with large pg_largeobject table
In-Reply-To: <6945.1534269481@sss.pgh.pa.us>
References: <CAK4GaZ551DKU=W4fuWYS1cgwftMT-jy7oBZsX65rCfbazDARVA@mail.gmail.com> <6945.1534269481@sss.pgh.pa.us>
* 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