BUG #14936: Huge backend memory usage during schema dump of database with many views

From: maxim(dot)boguk(at)gmail(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Cc: maxim(dot)boguk(at)gmail(dot)com
Subject: BUG #14936: Huge backend memory usage during schema dump of database with many views
Date: 2017-11-29 10:06:49
Message-ID: 20171129100649.1473.73990@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 14936
Logged by: Maksym Boguk
Email address: maxim(dot)boguk(at)gmail(dot)com
PostgreSQL version: 9.5.10
Operating system: Linux
Description:

Hi,

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");

This query used up to 15GB backend local memory before finishing in one
hour.

The database contains 22 schema with ~1000views in each schema, average view
length ~2kb (3+ table in each view), so total ~20-25k views.

If required, I can ask for dump of the few schemes to provide self-contained
test case.

Memory leak somewhere inside pg_get_viewdef?

Kind Regards,
Maksym

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Amit Kapila 2017-11-29 12:38:32 Re: BUG in 10.1 - dsa_area could not attach to a segment that has been freed
Previous Message Jurica Železnjak 2017-11-29 10:03:46 Re: BUG #14935: Cast function shortcut gives an error