From: | jian he <jian(dot)universality(at)gmail(dot)com> |
---|---|
To: | Corey Huinker <corey(dot)huinker(at)gmail(dot)com> |
Cc: | Jeff Davis <pgsql(at)j-davis(dot)com>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Magnus Hagander <magnus(at)hagander(dot)net>, Stephen Frost <sfrost(at)snowman(dot)net>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, alvherre(at)alvh(dot)no-ip(dot)org |
Subject: | Re: Statistics Import and Export |
Date: | 2025-01-16 14:43:24 |
Message-ID: | CACJufxFnLg=OptEGstUkZ=D=Emgz6F5PithTnXGPYzzrURfW8w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Jan 16, 2025 at 4:56 AM Corey Huinker <corey(dot)huinker(at)gmail(dot)com> wrote:
>>
> Attached is just the pg_dump stuff, and only for relation/attribute stats. The extended stats and vacuumdb work will be in their own threads going forward.
I didn't follow this thread actively,
so if the following issue is already addressed, please forgive me.
pg_dump --dbname=src2 --table=tenk1 --statistics-only --verbose > x.sql
there no pg_restore_attribute_stats, pg_restore_relation_stats there
for table tenk1.
There aren't any statistics, should there be?
also should
pg_dump --dbname=src2 --no-data --no-schema --table=tenk1
dump the statistics? currently seems no.
in doc/src/sgml/ref/pg_dump.sgml
there are six options to control the main output now.
--schema-only, --statistics-only, --data-only,
--no-schema, --no-data, --no-statistics
maybe we need spare one paragraph to explain the default behavior,
and also have an example on it?
pg_dump --dbname=src2 --table=tenk1 --verbose > 1.sql
seems the statistics dump (pg_restore_attribute_stats) is ordered by
attribute name.
should it make more sense to order by attnum?
getRelationStatistics
typedef struct _relStatsInfo
{
DumpableObject dobj;
char relkind; /* 'r', 'v', 'c', etc */
bool postponed_def;
} RelStatsInfo;
comment /* 'r', 'v', 'c', etc */
Is it wrong? there is no relkind='c'.
field postponed_def really deserves a comment.
we also need change
enum dbObjectTypePriorities
static const int dbObjectTypePriority[]
?
in dumpRelationStats, we can add Assert on it.
if (!fout->dopt->dumpStatistics)
return;
Assert(dobj->dump & DUMP_COMPONENT_STATISTICS);
I found out the owner's info is missing in the dumped content.
for example, the line "Name: STATISTICS DATA tenk1_pkey;" missing owner info.
not sure this is intended?
--
-- Name: tenk1 tenk1_pkey; Type: CONSTRAINT; Schema: public; Owner: jian
--
ALTER TABLE ONLY public.tenk1
ADD CONSTRAINT tenk1_pkey PRIMARY KEY (unique1);
--
-- Name: STATISTICS DATA tenk1_pkey; Type: STATISTICS DATA; Schema:
public; Owner: -
--
SELECT * FROM pg_catalog.pg_restore_relation_stats(
'relation', 'public.tenk1_pkey'::regclass,
'version', '180000'::integer,
'relpages', '30'::integer,
'reltuples', '10000'::real,
'relallvisible', '0'::integer
);
From | Date | Subject | |
---|---|---|---|
Next Message | Dean Rasheed | 2025-01-16 15:28:37 | Re: Adding OLD/NEW support to RETURNING |
Previous Message | Bernd Helmle | 2025-01-16 14:14:25 | Re: [PATCH] Add sortsupport for range types and btree_gist |