Re: Statistics Import and Export - Mailing list pgsql-hackers

From Ashutosh Bapat
Subject Re: Statistics Import and Export
Date
Msg-id CAExHW5vf9D+8-a5_BEX3y=2y_xY9hiCxV1=C+FnxDvfprWvkng@mail.gmail.com
Whole thread Raw
In response to Re: Statistics Import and Export  (jian he <jian.universality@gmail.com>)
List pgsql-hackers
Hi Jeff and Corey,

I think I have found a bug (arguably) with the dump/restore test I am
developing at [1].

#create table t1 (a int primary key, b int);
CREATE TABLE
#insert into t1 values (1, 2);
INSERT 0 1

$ createdb rdb
$ pg_dump -d postgres | psql -d rdb

$ pg_dump -d postgres > /tmp/pgdb.out
ashutosh@localhost:~/work/units/pg_dump_test$ pg_dump -d rdb > /tmp/rdb.out
ashutosh@localhost:~/work/units/pg_dump_test$ diff /tmp/pgdb.out /tmp/rdb.out
52,53c52,53
<       'relpages', '0'::integer,
<       'reltuples', '-1'::real,
---
>       'relpages', '1'::integer,
>       'reltuples', '1'::real,

So the dumped statistics are not restored exactly. The reason for this
is the table statistics is dumped before dumping ALTER TABLE ... ADD
CONSTRAINT command which changes the statistics. I think all the
pg_restore_relation_stats() calls should be dumped after all the
schema and data modifications have been done. OR what's the point in
dumping statistics only to get rewritten even before restore finishes.

[1] https://www.postgresql.org/message-id/CAExHW5sBbMki6Xs4XxFQQF3C4Wx3wxkLAcySrtuW3vrnOxXDNQ%40mail.gmail.com

-- 
Best Wishes,
Ashutosh Bapat



pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: proposal - plpgsql - support standard syntax for named arguments for cursors
Next
From: James Hunter
Date:
Subject: Re: Proposal: "query_work_mem" GUC, to distribute working memory to the query's individual operators