From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: Guyren Howe <guyren@gmail.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 16:04:21 -0700
Message-ID: <c03f4141-b64b-d29c-d3fa-8bd15dd4fa4c@aklaver.com> (raw)
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>
On 7/29/19 3:08 PM, Tom Lane wrote:
> 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.
Yeah that and access to the actual data. Not sure how you could run a
query that replicated the production(even with cloned stats) if the
table(s) are missing data. I could see throwing in dummy data, but it
would need to correlate with the actual data and you don't know what
that is. Then there is, what happens if you manually or
autovacuum/analyze the test data?
>
> regards, tom lane
>
--
Adrian Klaver
adrian.klaver@aklaver.com
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: adrian.klaver@aklaver.com, tgl@sss.pgh.pa.us, guyren@gmail.com
Subject: Re: Reproducing query plans in empty database: can I just copy stats and settings?
In-Reply-To: <c03f4141-b64b-d29c-d3fa-8bd15dd4fa4c@aklaver.com>
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> <c03f4141-b64b-d29c-d3fa-8bd15dd4fa4c@aklaver.com>
* 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