>
> * 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.

Reply via email to