Re: pg_dump is O(N) in DB table count N even if dumping only one table - Mailing list pgsql-bugs

From Tom Lane
Subject Re: pg_dump is O(N) in DB table count N even if dumping only one table
Date
Msg-id 21114.1370873065@sss.pgh.pa.us
Whole thread Raw
In response to pg_dump is O(N) in DB table count N even if dumping only one table  (Gunnlaugur Thor Briem <gunnlaugur@gmail.com>)
Responses Re: pg_dump is O(N) in DB table count N even if dumping only one table
List pgsql-bugs
Gunnlaugur Thor Briem <gunnlaugur@gmail.com> writes:
> 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.

This is not a bug.  It needs information about all the tables anyway
to deal with dependencies (possible inheritance and similar situations).

Having said that, it does look like getTables is pulling back a lot of
info that we don't need *yet*, and would never need if we conclude we
don't need to dump the table.  Possibly some of this work could usefully
be postponed to, say, getTableAttrs.  OTOH, if that makes the normal
dump-everything case noticeably slower, it's unlikely such a patch would
get accepted.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Gunnlaugur Thor Briem
Date:
Subject: pg_dump is O(N) in DB table count N even if dumping only one table
Next
From: Andres Freund
Date:
Subject: Re: pg_dump is O(N) in DB table count N even if dumping only one table