pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedpg_dump -Are statistics saved?
4+ messages / 4 participants
[nested] [flat]
* pg_dump -Are statistics saved?
@ 2023-11-28 00:28 Murthy Nunna <mnunna@fnal.gov>
0 siblings, 2 replies; 4+ messages in thread
From: Murthy Nunna @ 2023-11-28 00:28 UTC (permalink / raw)
To: pgsql-admin
Hello,
We are running pg version 14.4
I did a pg_dump of a fairly large database (~20TB). I plan to pg_restore it on same server after upgrading Linux from Scientific Linux release 7.9 to Alma 9. We are forced to do pg_dump/pg_restore due to glibc collation changes in Alma 9.
The pg_dump (used verbose) log said "pg_dump: reading extended statistics".
Does it mean it saved statistics and they can be restored with pg_restore? If not, is it necessary to run ANALYZE after pg_restore?
Thanks in advance for responding.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: pg_dump -Are statistics saved?
@ 2023-11-28 00:31 David G. Johnston <david.g.johnston@gmail.com>
parent: Murthy Nunna <mnunna@fnal.gov>
1 sibling, 0 replies; 4+ messages in thread
From: David G. Johnston @ 2023-11-28 00:31 UTC (permalink / raw)
To: Murthy Nunna <mnunna@fnal.gov>; +Cc: pgsql-admin
On Mon, Nov 27, 2023 at 5:28 PM Murthy Nunna <mnunna@fnal.gov> wrote:
> Does it mean it saved statistics and they can be restored with pg_restore?
> If not, is it necessary to run ANALYZE after pg_restore?
>
>
>
Logical dumps do not output system catalogs except large objects. It
outputs object definitions In SQL form. Though I'm unsure of that specific
message.
David J.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: pg_dump -Are statistics saved?
@ 2023-11-28 00:45 Tom Lane <tgl@sss.pgh.pa.us>
parent: Murthy Nunna <mnunna@fnal.gov>
1 sibling, 1 reply; 4+ messages in thread
From: Tom Lane @ 2023-11-28 00:45 UTC (permalink / raw)
To: Murthy Nunna <mnunna@fnal.gov>; +Cc: pgsql-admin
Murthy Nunna <mnunna@fnal.gov> writes:
> The pg_dump (used verbose) log said "pg_dump: reading extended statistics".
> Does it mean it saved statistics and they can be restored with pg_restore?
What that means is that it will output clones of any CREATE STATISTICS
commands you may have issued.
> If not, is it necessary to run ANALYZE after pg_restore?
That has always been necessary after a dump/restore, and still is.
The pg_dump man page makes this clear enough, I should think:
The dump file produced by pg_dump does not contain the statistics used
by the optimizer to make query planning decisions. Therefore, it is
wise to run ANALYZE after restoring from a dump file to ensure optimal
performance; see Section 25.1.3 and Section 25.1.6 for more
information.
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: pg_dump -Are statistics saved?
@ 2023-11-28 06:55 Laurenz Albe <laurenz.albe@cybertec.at>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 4+ messages in thread
From: Laurenz Albe @ 2023-11-28 06:55 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; Murthy Nunna <mnunna@fnal.gov>; +Cc: pgsql-admin
On Mon, 2023-11-27 at 19:45 -0500, Tom Lane wrote:
> Murthy Nunna <mnunna@fnal.gov> writes:
>
>
> > If not, is it necessary to run ANALYZE after pg_restore?
>
> That has always been necessary after a dump/restore, and still is.
> The pg_dump man page makes this clear enough, I should think:
>
> The dump file produced by pg_dump does not contain the statistics used
> by the optimizer to make query planning decisions. Therefore, it is
> wise to run ANALYZE after restoring from a dump file to ensure optimal
> performance; see Section 25.1.3 and Section 25.1.6 for more
> information.
If you are not pressed for time, you can wait until autovacuum gets around
to calculating the statistics automatically.
Yours,
Laurenz Albe
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2023-11-28 06:55 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-11-28 00:28 pg_dump -Are statistics saved? Murthy Nunna <mnunna@fnal.gov>
2023-11-28 00:31 ` David G. Johnston <david.g.johnston@gmail.com>
2023-11-28 00:45 ` Tom Lane <tgl@sss.pgh.pa.us>
2023-11-28 06:55 ` Laurenz Albe <laurenz.albe@cybertec.at>
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