Re: Reproducing query plans in empty database: can I just copy stats and settings?

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Guyren Howe <guyren(at)gmail(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Reproducing query plans in empty database: can I just copy stats and settings?
Date: 2019-07-29 23:04:21
Message-ID: c03f4141-b64b-d29c-d3fa-8bd15dd4fa4c@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 7/29/19 3:08 PM, Tom Lane wrote:
> Guyren Howe <guyren(at)gmail(dot)com> writes:
>> On Jul 29, 2019, at 12:25 , Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)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(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Marcos Aurelio Nobre 2019-07-30 00:49:56 How do I create a Backup Operator account ?
Previous Message Tom Lane 2019-07-29 22:08:06 Re: Reproducing query plans in empty database: can I just copy stats and settings?