Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hsDoU-0006WT-DG for pgsql-general@arkaria.postgresql.org; Mon, 29 Jul 2019 22:08:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hsDoS-00038S-Vn for pgsql-general@arkaria.postgresql.org; Mon, 29 Jul 2019 22:08:12 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hsDoS-00038J-J2 for pgsql-general@lists.postgresql.org; Mon, 29 Jul 2019 22:08:12 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1hsDoQ-00070g-E9 for pgsql-general@lists.postgresql.org; Mon, 29 Jul 2019 22:08:11 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x6TM86tj021597; Mon, 29 Jul 2019 18:08:06 -0400 From: Tom Lane To: Guyren Howe cc: Adrian Klaver , "pgsql-general@lists.postgresql.org" Subject: Re: Reproducing query plans in empty database: can I just copy stats and settings? In-reply-to: <70D44AFB-74C8-4643-81C2-0A0143C68C47@gmail.com> References: <7e758c6c-6e6f-d6b4-6ce5-55ac2bb95586@aklaver.com> <70D44AFB-74C8-4643-81C2-0A0143C68C47@gmail.com> Comments: In-reply-to Guyren Howe message dated "Mon, 29 Jul 2019 14:59:08 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <21595.1564438086.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 29 Jul 2019 18:08:06 -0400 Message-ID: <21596.1564438086@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Guyren Howe writes: > On Jul 29, 2019, at 12:25 , Adrian Klaver wr= ote: >> If you can't see/use the data in the production database in your test d= atabase I'm not sure how copying the statistics/cost settings is going to = help. > Isn=E2=80=99t 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