From: | David Rowley <dgrowleyml(at)gmail(dot)com> |
---|---|
To: | "Ryohei Takahashi (Fujitsu)" <r(dot)takahashi_2(at)fujitsu(dot)com> |
Cc: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Can we use Statistics Import and Export feature to perforamance testing? |
Date: | 2025-04-08 07:09:00 |
Message-ID: | CAApHDvozyyTc19zhnWSqMhvW_dqYJCCkdh5mo3DA65zEFPu8fg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, 8 Apr 2025 at 12:21, Ryohei Takahashi (Fujitsu)
<r(dot)takahashi_2(at)fujitsu(dot)com> wrote:
> 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).
You could certainly test the performance, but this method isn't
guaranteed to give meaningful results just because the table stats
match. One important thing to remember is that the planner also looks
at the *actual size* of the relation and takes that into account when
scaling the statistics (see table_block_relation_estimate_size() in
tableam.c). If the table sizes don't match between the two servers
then there's no guarantees the planner will produce the same plan.
Also, there might be other subtleties regarding OIDs of indexes which
are not guaranteed to be the same after dump/restore. Given some
fuzzily close enough cost estimates (See add_path() and
compare_path_costs_fuzzily()), it is possible a plan would switch to
using another index if sorting the indexes by their OIDs didn't match
on each server. The chances of that might be fairly small, but not
zero.
You'd also need to ensure the configs are the same in terms of GUCs
that are used for costs.
You could probably use get_relation_info_hook to overwrite the sizes
and make sure the indexes are in the same order, etc.
David
From | Date | Subject | |
---|---|---|---|
Next Message | Hannu Krosing | 2025-04-08 07:15:45 | Re: Horribly slow pg_upgrade performance with many Large Objects |
Previous Message | Andres Freund | 2025-04-08 07:04:32 | Re: BAS_BULKREAD vs read stream |