Re: pgsql: Transfer statistics during pg_upgrade.

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>, Jeff Davis <jdavis(at)postgresql(dot)org>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Transfer statistics during pg_upgrade.
Date: 2025-04-08 16:42:29
Message-ID: cfd360dda6e13a47c5ce2baf538fe697fcceb947.camel@j-davis.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Tue, 2025-04-08 at 17:24 +1200, David Rowley wrote:
> I was surprised to see when I did pg_dump -T just_this_table that I
> also got statistics data for all tables in the database.

-T means "exclude this pattern"

I tried a few basic variations and they seemed to do what I expected:

CREATE TABLE mytable1(i INT);
INSERT INTO mytable1 VALUES(1);
CREATE TABLE mytable2(i INT);
INSERT INTO mytable2 VALUES(2);
CREATE TABLE mytable3(i INT);
INSERT INTO mytable3 VALUES(3);
ANALYZE;

$ ./bin/pg_dump -t mytable1 postgres | grep "Name: mytable"
-- Name: mytable1; Type: TABLE; Schema: public; Owner: jdavis
-- Data for Name: mytable1; Type: TABLE DATA; Schema: ...
-- Statistics for Name: mytable1; Type: STATISTICS DATA; ...

$ ./bin/pg_dump -T mytable1 postgres | grep "Name: mytable"
-- Name: mytable2; Type: TABLE; Schema: public; Owner: jdavis
-- Name: mytable3; Type: TABLE; Schema: public; Owner: jdavis
-- Data for Name: mytable2; Type: TABLE DATA; Schema: ...
-- Data for Name: mytable3; Type: TABLE DATA; Schema: ...
-- Statistics for Name: mytable2; Type: STATISTICS DATA; ...
-- Statistics for Name: mytable3; Type: STATISTICS DATA; ...

If you still see a problem, please let me know.

Regards,
Jeff Davis

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2025-04-08 17:06:33 Re: pgsql: Make cancel request keys longer
Previous Message Nathan Bossart 2025-04-08 15:58:28 pgsql: Prevent 006_transfer_modes.pl from leaving files behind.