pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedpg_dump of database with numerous objects
12+ messages / 5 participants
[nested] [flat]
* pg_dump of database with numerous objects
@ 2020-05-31 15:05 tony@exquisiteimages.com
0 siblings, 3 replies; 12+ messages in thread
From: tony@exquisiteimages.com @ 2020-05-31 15:05 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
I have always used pg_basebackup to backup my database and I have never
had any issues.
I am now needing to upgrade to a new version of PostgreSQL and I am
running into problems when pg_upgrade calls pg_dump. pg_dump stalled at:
"pg_dump: saving database definition" for 24 hours before I killed the
process.
My pg_class table contains 9,000,000 entries and I have 9004 schema.
I was able to get output from pg_dump if I used the -n option to dump
schema with wildcards. I was able to use -n 'data???x' where x was a
digit from 0 to 9. This way I was able to execute 10 concurrent pg_dump
processes and dump the database in 30 minutes. I then dumped the public
schema and used pg_dumpall to dump the globals.
Can anyone tell me if there is something else I need to do to manually
dump the database? What I did do seems to have restored correctly on the
upgraded server, but if I want to make sure that I haven't missed
anything that will creep up on me.
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: pg_dump of database with numerous objects
@ 2020-05-31 15:24 Adrian Klaver <adrian.klaver@aklaver.com>
parent: tony@exquisiteimages.com
2 siblings, 1 reply; 12+ messages in thread
From: Adrian Klaver @ 2020-05-31 15:24 UTC (permalink / raw)
To: tony@exquisiteimages.com; pgsql-general@lists.postgresql.org
On 5/31/20 8:05 AM, tony@exquisiteimages.com wrote:
> I have always used pg_basebackup to backup my database and I have never
> had any issues.
>
> I am now needing to upgrade to a new version of PostgreSQL and I am
> running into problems when pg_upgrade calls pg_dump. pg_dump stalled at:
> "pg_dump: saving database definition" for 24 hours before I killed the
> process.
Where you using the jobs option?:
https://www.postgresql.org/docs/12/pgupgrade.html
-j njobs
--jobs=njobs
number of simultaneous processes or threads to use
>
> My pg_class table contains 9,000,000 entries and I have 9004 schema.
>
> I was able to get output from pg_dump if I used the -n option to dump
> schema with wildcards. I was able to use -n 'data???x' where x was a
> digit from 0 to 9. This way I was able to execute 10 concurrent pg_dump
> processes and dump the database in 30 minutes. I then dumped the public
> schema and used pg_dumpall to dump the globals.
>
> Can anyone tell me if there is something else I need to do to manually
> dump the database? What I did do seems to have restored correctly on the
> upgraded server, but if I want to make sure that I haven't missed
> anything that will creep up on me.
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: pg_dump of database with numerous objects
@ 2020-05-31 17:06 tony@exquisiteimages.com
parent: Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 0 replies; 12+ messages in thread
From: tony@exquisiteimages.com @ 2020-05-31 17:06 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 2020-05-31 11:24, Adrian Klaver wrote:
> On 5/31/20 8:05 AM, tony@exquisiteimages.com wrote:
>> I have always used pg_basebackup to backup my database and I have
>> never had any issues.
>>
>> I am now needing to upgrade to a new version of PostgreSQL and I am
>> running into problems when pg_upgrade calls pg_dump. pg_dump stalled
>> at: "pg_dump: saving database definition" for 24 hours before I killed
>> the process.
>
> Where you using the jobs option?:
>
> https://www.postgresql.org/docs/12/pgupgrade.html
>
> -j njobs
> --jobs=njobs
>
> number of simultaneous processes or threads to use
Yes, I did try with this option. It did dump the postgres database at
the same time as my main database, but my database hung in the same
place.
>
>>
>> My pg_class table contains 9,000,000 entries and I have 9004 schema.
>>
>> I was able to get output from pg_dump if I used the -n option to dump
>> schema with wildcards. I was able to use -n 'data???x' where x was a
>> digit from 0 to 9. This way I was able to execute 10 concurrent
>> pg_dump processes and dump the database in 30 minutes. I then dumped
>> the public schema and used pg_dumpall to dump the globals.
>>
>> Can anyone tell me if there is something else I need to do to manually
>> dump the database? What I did do seems to have restored correctly on
>> the upgraded server, but if I want to make sure that I haven't missed
>> anything that will creep up on me.
>>
>>
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: pg_dump of database with numerous objects
@ 2020-05-31 17:08 Christophe Pettus <xof@thebuild.com>
parent: tony@exquisiteimages.com
2 siblings, 1 reply; 12+ messages in thread
From: Christophe Pettus @ 2020-05-31 17:08 UTC (permalink / raw)
To: tony@exquisiteimages.com; +Cc: pgsql-general@lists.postgresql.org
> On May 31, 2020, at 08:05, tony@exquisiteimages.com wrote:
>
> My pg_class table contains 9,000,000 entries and I have 9004 schema.
Which version of pg_dump are you running? Older versions (don't have the precise major version in front of me) have N^2 behavior on the number of database objects being dumped.
--
-- Christophe Pettus
xof@thebuild.com
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: pg_dump of database with numerous objects
@ 2020-05-31 20:10 tony@exquisiteimages.com
parent: Christophe Pettus <xof@thebuild.com>
0 siblings, 1 reply; 12+ messages in thread
From: tony@exquisiteimages.com @ 2020-05-31 20:10 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 2020-05-31 13:08, Christophe Pettus wrote:
>> On May 31, 2020, at 08:05, tony@exquisiteimages.com wrote:
>>
>> My pg_class table contains 9,000,000 entries and I have 9004 schema.
>
> Which version of pg_dump are you running? Older versions (don't have
> the precise major version in front of me) have N^2 behavior on the
> number of database objects being dumped.
I am upgrading from 9.3
>
> --
> -- Christophe Pettus
> xof@thebuild.com
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: pg_dump of database with numerous objects
@ 2020-05-31 20:13 Christophe Pettus <xof@thebuild.com>
parent: tony@exquisiteimages.com
0 siblings, 1 reply; 12+ messages in thread
From: Christophe Pettus @ 2020-05-31 20:13 UTC (permalink / raw)
To: tony@exquisiteimages.com; +Cc: pgsql-general@lists.postgresql.org
> On May 31, 2020, at 13:10, tony@exquisiteimages.com wrote:
>
> On 2020-05-31 13:08, Christophe Pettus wrote:
>>> On May 31, 2020, at 08:05, tony@exquisiteimages.com wrote:
>>> My pg_class table contains 9,000,000 entries and I have 9004 schema.
>> Which version of pg_dump are you running? Older versions (don't have
>> the precise major version in front of me) have N^2 behavior on the
>> number of database objects being dumped.
>
> I am upgrading from 9.3
To which version? You might try the dump with the version of pg_dump corresponding to the PostgreSQL version you are upgrading *to* (which is recommended practice, anyway) to see if that improves matters.
--
-- Christophe Pettus
xof@thebuild.com
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: pg_dump of database with numerous objects
@ 2020-05-31 20:37 Adrian Klaver <adrian.klaver@aklaver.com>
parent: Christophe Pettus <xof@thebuild.com>
0 siblings, 1 reply; 12+ messages in thread
From: Adrian Klaver @ 2020-05-31 20:37 UTC (permalink / raw)
To: Christophe Pettus <xof@thebuild.com>; tony@exquisiteimages.com; +Cc: pgsql-general@lists.postgresql.org
On 5/31/20 1:13 PM, Christophe Pettus wrote:
>
>
>> On May 31, 2020, at 13:10, tony@exquisiteimages.com wrote:
>>
>> On 2020-05-31 13:08, Christophe Pettus wrote:
>>>> On May 31, 2020, at 08:05, tony@exquisiteimages.com wrote:
>>>> My pg_class table contains 9,000,000 entries and I have 9004 schema.
>>> Which version of pg_dump are you running? Older versions (don't have
>>> the precise major version in front of me) have N^2 behavior on the
>>> number of database objects being dumped.
>>
>> I am upgrading from 9.3
>
> To which version? You might try the dump with the version of pg_dump corresponding to the PostgreSQL version you are upgrading *to* (which is recommended practice, anyway) to see if that improves matters.
Just a reminder that the OP's original issue was with using pg_upgrade.
>
> --
> -- Christophe Pettus
> xof@thebuild.com
>
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: pg_dump of database with numerous objects
@ 2020-05-31 20:38 Christophe Pettus <xof@thebuild.com>
parent: Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 1 reply; 12+ messages in thread
From: Christophe Pettus @ 2020-05-31 20:38 UTC (permalink / raw)
To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: tony@exquisiteimages.com; pgsql-general@lists.postgresql.org
> On May 31, 2020, at 13:37, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
>
> Just a reminder that the OP's original issue was with using pg_upgrade.
True, although IIRC pg_ugprade uses pg_dump under the hood to do the schema migration.
--
-- Christophe Pettus
xof@thebuild.com
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: pg_dump of database with numerous objects
@ 2020-05-31 21:02 Adrian Klaver <adrian.klaver@aklaver.com>
parent: Christophe Pettus <xof@thebuild.com>
0 siblings, 1 reply; 12+ messages in thread
From: Adrian Klaver @ 2020-05-31 21:02 UTC (permalink / raw)
To: Christophe Pettus <xof@thebuild.com>; +Cc: tony@exquisiteimages.com; pgsql-general@lists.postgresql.org
On 5/31/20 1:38 PM, Christophe Pettus wrote:
>
>
>> On May 31, 2020, at 13:37, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
>>
>> Just a reminder that the OP's original issue was with using pg_upgrade.
>
> True, although IIRC pg_ugprade uses pg_dump under the hood to do the schema migration.
Again true, but pg_upgrade will not work older to newer:
/usr/local/pgsql11/bin/pg_upgrade --check -U postgres -d
/usr/local/pgsql11/data -D /usr/local/pgsql12_up/data -b
/usr/local/pgsql11/bin -B /usr/local/pgsql12/bin
Performing Consistency Checks
-----------------------------
Checking cluster versions
This utility can only upgrade to PostgreSQL version 11.
Failure, exiting
>
> --
> -- Christophe Pettus
> xof@thebuild.com
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: pg_dump of database with numerous objects
@ 2020-06-03 20:10 Alvaro Herrera <alvherre@2ndquadrant.com>
parent: tony@exquisiteimages.com
2 siblings, 1 reply; 12+ messages in thread
From: Alvaro Herrera @ 2020-06-03 20:10 UTC (permalink / raw)
To: tony@exquisiteimages.com; +Cc: pgsql-general@lists.postgresql.org
On 2020-May-31, tony@exquisiteimages.com wrote:
> I am now needing to upgrade to a new version of PostgreSQL and I am running
> into problems when pg_upgrade calls pg_dump. pg_dump stalled at: "pg_dump:
> saving database definition" for 24 hours before I killed the process.
>
> My pg_class table contains 9,000,000 entries and I have 9004 schema.
We've made a number of performance improvements to pg_dump so that it
can dump databases that are "large" in several different dimensions, but
evidently from your report it is not yet good enough when it comes to
dumping millions of tables in thousands of schemas. It will probably
take some profiling of pg_dump to figure out where the bottleneck is,
and some careful optimization work in order to make it faster. Not a
weekend job, I'm afraid :-(
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: pg_dump of database with numerous objects
@ 2020-06-13 17:55 Bruce Momjian <bruce@momjian.us>
parent: Alvaro Herrera <alvherre@2ndquadrant.com>
0 siblings, 0 replies; 12+ messages in thread
From: Bruce Momjian @ 2020-06-13 17:55 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@2ndquadrant.com>; +Cc: tony@exquisiteimages.com; pgsql-general@lists.postgresql.org
On Wed, Jun 3, 2020 at 04:10:55PM -0400, Alvaro Herrera wrote:
> On 2020-May-31, tony@exquisiteimages.com wrote:
>
> > I am now needing to upgrade to a new version of PostgreSQL and I am running
> > into problems when pg_upgrade calls pg_dump. pg_dump stalled at: "pg_dump:
> > saving database definition" for 24 hours before I killed the process.
> >
> > My pg_class table contains 9,000,000 entries and I have 9004 schema.
>
> We've made a number of performance improvements to pg_dump so that it
> can dump databases that are "large" in several different dimensions, but
> evidently from your report it is not yet good enough when it comes to
> dumping millions of tables in thousands of schemas. It will probably
> take some profiling of pg_dump to figure out where the bottleneck is,
> and some careful optimization work in order to make it faster. Not a
> weekend job, I'm afraid :-(
FYI, we never actually found what version of pg_dump was being used,
since pg_upgrade uses the pg_dump version in the newer cluster. We only
know the user is coming _from_ 9.3.
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EnterpriseDB https://enterprisedb.com
The usefulness of a cup is in its emptiness, Bruce Lee
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: pg_dump of database with numerous objects
@ 2020-06-13 17:57 Bruce Momjian <bruce@momjian.us>
parent: Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 0 replies; 12+ messages in thread
From: Bruce Momjian @ 2020-06-13 17:57 UTC (permalink / raw)
To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: Christophe Pettus <xof@thebuild.com>; tony@exquisiteimages.com; pgsql-general@lists.postgresql.org
On Sun, May 31, 2020 at 02:02:08PM -0700, Adrian Klaver wrote:
> On 5/31/20 1:38 PM, Christophe Pettus wrote:
> >
> >
> > > On May 31, 2020, at 13:37, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
> > >
> > > Just a reminder that the OP's original issue was with using pg_upgrade.
> >
> > True, although IIRC pg_ugprade uses pg_dump under the hood to do the schema migration.
>
> Again true, but pg_upgrade will not work older to newer:
>
> /usr/local/pgsql11/bin/pg_upgrade --check -U postgres -d
> /usr/local/pgsql11/data -D /usr/local/pgsql12_up/data -b
> /usr/local/pgsql11/bin -B /usr/local/pgsql12/bin
>
> Performing Consistency Checks
> -----------------------------
> Checking cluster versions
> This utility can only upgrade to PostgreSQL version 11.
> Failure, exiting
This is saying you can only use pg_upgrade 11.X to upgrade _to_ Postgres
11.X. If you want to upgrade to 12, you have to use pg_upgrade from 12.
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EnterpriseDB https://enterprisedb.com
The usefulness of a cup is in its emptiness, Bruce Lee
^ permalink raw reply [nested|flat] 12+ messages in thread
end of thread, other threads:[~2020-06-13 17:57 UTC | newest]
Thread overview: 12+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-05-31 15:05 pg_dump of database with numerous objects tony@exquisiteimages.com
2020-05-31 15:24 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-05-31 17:06 ` tony@exquisiteimages.com
2020-05-31 17:08 ` Christophe Pettus <xof@thebuild.com>
2020-05-31 20:10 ` tony@exquisiteimages.com
2020-05-31 20:13 ` Christophe Pettus <xof@thebuild.com>
2020-05-31 20:37 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-05-31 20:38 ` Christophe Pettus <xof@thebuild.com>
2020-05-31 21:02 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-13 17:57 ` Bruce Momjian <bruce@momjian.us>
2020-06-03 20:10 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2020-06-13 17:55 ` Bruce Momjian <bruce@momjian.us>
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