Re: pg_dump is O(N) in DB table count N even if dumping only one table

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Gunnlaugur Thor Briem <gunnlaugur(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: pg_dump is O(N) in DB table count N even if dumping only one table
Date: 2013-06-10 14:08:43
Message-ID: 20130610140843.GA5680@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 2013-06-10 13:28:32 +0000, Gunnlaugur Thor Briem wrote:
> Hi,
>
> pg_dump takes O(N) time dumping just one table (or a few) explicitly
> specified with a -t parameter. It thus becomes painfully slow on a database
> with very many tables.
>
> (The use case is copying a few tables over to a test DB, from a large
> production data warehouse.)
>
> The three queries taking O(N) time are listed below. AFAICT each of these
> queries could be filtered by table name/OID, at least when the number of
> tables matching the -t parameters is small, allowing pg_dump to complete in
> seconds rather than minutes.

Which of those queries take how long in your case?

E.g. I could imagine that the first two can be sped up a bit without
changing the result. E.g. not calling pg_tablespace_location() for every
relation and such.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Gunnlaugur Thor Briem 2013-06-10 14:11:34 Re: pg_dump is O(N) in DB table count N even if dumping only one table
Previous Message Tom Lane 2013-06-10 14:04:25 Re: pg_dump is O(N) in DB table count N even if dumping only one table