pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: maxim.boguk@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14936: Huge backend memory usage during schema dump of database with many views
Date: Wed, 29 Nov 2017 09:48:06 -0500
Message-ID: <29532.1511966886@sss.pgh.pa.us> (raw)
In-Reply-To: <20171129100649.1473.73990@wrigleys.postgresql.org>
References: <20171129100649.1473.73990@wrigleys.postgresql.org>

maxim.boguk@gmail.com writes:
> I got off-list report of the following issue:
> server used all memory and crash with OOM during pg_dump of the database
> with many schemes and views.
> After removing all extra stuff problem can be show with simple run the
> following query on the database:
> select (CASE WHEN pg_has_role(c.relowner, 'USAGE'::text) THEN
> pg_get_viewdef(c.oid) ELSE NULL::text END) as view_src from pg_class c where
> (c.relkind = 'v'::"char"); 

Hm.  It's certainly no surprise if pg_get_viewdef eats memory, but why
wouldn't it get reclaimed at the end of each tuple cycle?

Also: I don't think the above query is very representative of what
pg_dump actually does; AFAIR it pulls view definitions one at a time,
not all at once.

That leads me to guess that what's going on is relcache bloat, since
relcache entries would persist across queries.  There's no mechanism
for limiting the number of entries in that cache.

			regards, tom lane




view thread (2+ messages)

Message-ID: <29532.1511966886@sss.pgh.pa.us>
Permalink:  ../29532.1511966886@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/29532.1511966886@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, maxim.boguk@gmail.com
  Subject: Re: BUG #14936: Huge backend memory usage during schema dump of database with many views
  In-Reply-To: <29532.1511966886@sss.pgh.pa.us>
  References: <20171129100649.1473.73990@wrigleys.postgresql.org> <29532.1511966886@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