From: Tom Lane <tgl@sss.pgh.pa.us>
To: Guyren Howe <guyren@gmail.com>
Cc: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Reproducing query plans in empty database: can I just copy stats and settings?
Date: Mon, 29 Jul 2019 18:08:06 -0400
Message-ID: <21596.1564438086@sss.pgh.pa.us> (raw)
In-Reply-To: <70D44AFB-74C8-4643-81C2-0A0143C68C47@gmail.com>
References: <E72D67A1-66F6-461F-B4FC-AF032AFEDE84@gmail.com>
<7e758c6c-6e6f-d6b4-6ce5-55ac2bb95586@aklaver.com>
<70D44AFB-74C8-4643-81C2-0A0143C68C47@gmail.com>
Guyren Howe <guyren@gmail.com> writes:
> On Jul 29, 2019, at 12:25 , Adrian Klaver <adrian.klaver@aklaver.com> wrote:
>> If you can't see/use the data in the production database in your test database I'm not sure how copying the statistics/cost settings is going to help.
> Isn’t that the entirety of what the query plan is based on?
No; physical sizes of the tables and indexes also matter. (The planner
scales some cost values by those numbers to account for the likelihood
that tables have grown since they were last analyzed.) You could deal
with that by bloating them with dummy data, of course.
I think though that Adrian's point is a bit different: if you're not
allowed to see the original data, you should not be allowed to see
the statistics either. The histogram values and most-common-values
lists represent a pretty sizable information leak for such cases.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, guyren@gmail.com, adrian.klaver@aklaver.com
Subject: Re: Reproducing query plans in empty database: can I just copy stats and settings?
In-Reply-To: <21596.1564438086@sss.pgh.pa.us>
References: <E72D67A1-66F6-461F-B4FC-AF032AFEDE84@gmail.com> <7e758c6c-6e6f-d6b4-6ce5-55ac2bb95586@aklaver.com> <70D44AFB-74C8-4643-81C2-0A0143C68C47@gmail.com> <21596.1564438086@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox