Re: Can we use Statistics Import and Export feature to perforamance testing? - Mailing list pgsql-hackers

From Corey Huinker
Subject Re: Can we use Statistics Import and Export feature to perforamance testing?
Date
Msg-id CADkLM=edE4r+YBYX9Yv00h+AjrhGKB53NC-0egyoKRu57iq+5Q@mail.gmail.com
Whole thread Raw
In response to Can we use Statistics Import and Export feature to perforamance testing?  ("Ryohei Takahashi (Fujitsu)" <r.takahashi_2@fujitsu.com>)
List pgsql-hackers

* Question

By using Statistics Import and Export feature, is it possible to achieve the above request by following procedure?

 

(1) Export the statistics from production environment by using pg_dump --statistics-only.

(2) On the staging environment, set the autovacuum related parameters to prevent autovacuum from running.

(3) Import the statistics to staging environment by using the result of (1).


This was one of the initial intended uses for the statistical import functions, specifically the pg_set_(relation|attribute)_stats variants. Those variants have gone away, but the main functional difference was that pg_restore_relation_stats() did inplace updates (it no longer does), and without that difference set- variants became redundant.

So your procedure should still work so long as those statistics remain in place, but just for explain plan generation of queries in isolation - there is no way through statistics to make a large production query that overflows work_mem do the same on a small test database, or other effects that are a consequence of finding real data in the tables.

pgsql-hackers by date:

Previous
From: Corey Huinker
Date:
Subject: Re: Can we use Statistics Import and Export feature to perforamance testing?
Next
From: Corey Huinker
Date:
Subject: Re: someone else to do the list of acknowledgments