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 1hsDgN-0006DH-9k for pgsql-general@arkaria.postgresql.org; Mon, 29 Jul 2019 21:59:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hsDgM-0006db-1h for pgsql-general@arkaria.postgresql.org; Mon, 29 Jul 2019 21:59:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hsDgL-0006dU-LW for pgsql-general@lists.postgresql.org; Mon, 29 Jul 2019 21:59:49 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hsDgI-0004pK-QE for pgsql-general@lists.postgresql.org; Mon, 29 Jul 2019 21:59:49 +0000 Received: by mail-pl1-x641.google.com with SMTP id c2so27994420plz.13 for ; Mon, 29 Jul 2019 14:59:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc:message-id:references :to; bh=kyuVw7mLgL/ihGhQARfYNtakV3AFYesW5LGm4ue6n1A=; b=OCnSel75079VFrqPwi6vvQXgCxkAvr2M4SbCM9KTYJO3Df8svp52IaXMuYwmBKia3z 8HpJSVIJCXmqfMT0FtONEij6WMZbPwJtW4D49OihH1kRcxXwOs7wo5RBRiA+YnU+LDw4 sLh9BBKlFEjxUokfNyoYYXiw6ICql1Yekwi7Phe11LqG+yywosZyYP8XF9mLg7Ihfrl1 dumEHSU8jR3Q/tisgSgsVVkwpYcOda9DyMWFNSDbnV/BYx3l+er5Z/OfGwoLiH5f7kzO 0sffG0xK3Q6eyHwpONpIcZVJ78IG9eRpxcKYl/k8zmO9gU4qH91nln+AJYM4oP0WB0p6 SSPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; bh=kyuVw7mLgL/ihGhQARfYNtakV3AFYesW5LGm4ue6n1A=; b=W+T5goEtoIUc0B8dHyL/uK6d/XrWyrQsPLyzC1IjghasVRFNKES5FdKOEyIgK8U+jq sKrB0tv1FzTimDeHSkUQRQC3aZVFuXVz3VPqWjFdFOxNY+ekFOj/XR3OSfBISo979ui5 zn7NLGbFiLuvgjeKjSNrZQrbDVV3RShzuC06lRKmWTfs14Xh2lX4WAIVYjWI3x2QYJOT LcS7zBDiKBGpm8sE6UMSd5UX+nCJ1oSOOEOKR/Reta9DQOY1vqeE+41ZZwkfmOBtnVCK mQ/gGX0zHi/YRYI1QR5zs+R1Q5ECtLRLaUBQu54mb3DtLxO45EGVY60SHxIIz0w8bfbF dQIA== X-Gm-Message-State: APjAAAVvXvjCyy42pjwwTk/nFWyK9WD/9ot4AComKUOzoId6AgoK7cDx 6EeSC9FeEtnz+ziMR50kxeMDOG50nZM= X-Google-Smtp-Source: APXvYqxrL+LHBlNTF5I1Zcy1VfDFQTxrHxSsCIk3QRfZDmU6zqOvGw60oiBqmyg4bzykamlhTNNHMA== X-Received: by 2002:a17:902:1125:: with SMTP id d34mr112205113pla.40.1564437582975; Mon, 29 Jul 2019 14:59:42 -0700 (PDT) Received: from ?IPv6:2600:8801:8800:16e::12? ([2600:8801:8800:16e::12]) by smtp.gmail.com with ESMTPSA id d17sm72153904pgl.66.2019.07.29.14.59.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Jul 2019 14:59:42 -0700 (PDT) Content-Type: multipart/alternative; boundary="Apple-Mail=_6898639E-F4C4-4ED9-94AE-00D0AB084642" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: Reproducing query plans in empty database: can I just copy stats and settings? From: Guyren Howe In-Reply-To: <7e758c6c-6e6f-d6b4-6ce5-55ac2bb95586@aklaver.com> Date: Mon, 29 Jul 2019 14:59:08 -0700 Cc: "pgsql-general@lists.postgresql.org" X-Mailbutler-Message-Id: B7AE9BE4-2211-45DF-9610-181AF4B09EC3 Message-Id: <70D44AFB-74C8-4643-81C2-0A0143C68C47@gmail.com> References: <7e758c6c-6e6f-d6b4-6ce5-55ac2bb95586@aklaver.com> To: Adrian Klaver X-Mailer: Apple Mail (2.3445.104.11) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_6898639E-F4C4-4ED9-94AE-00D0AB084642 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 On Jul 29, 2019, at 12:25 , Adrian Klaver = wrote: >=20 > On 7/29/19 12:07 PM, Guyren Howe wrote: >> I work with Protected Health Information so have restricted access to = an important database. >> I would like to look into index and query changes for that database. = It occurs to me that if I was able to reproduce the statistics and cost = settings for the database, then Explain would produce identical results = to the production database. >> Can do this? Any other advice? >=20 > So what defines restricted access? >=20 > 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=E2=80=99t that the entirety of what the query plan is based on? I = was hoping I could then run Explain as if I had the data. --Apple-Mail=_6898639E-F4C4-4ED9-94AE-00D0AB084642 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 On = Jul 29, 2019, at 12:25 , Adrian Klaver <adrian.klaver@aklaver.com> wrote:

On 7/29/19 12:07 PM, Guyren Howe = wrote:
I = work with Protected Health Information so have restricted access to an = important database.
I would like to look into index and = query changes for that database. It occurs to me that if I was able to = reproduce the statistics and cost settings for the database, then = Explain would produce identical results to the production database.
Can do this? Any other advice?

So what defines restricted = access?

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=E2=80=99t that = the entirety of what the query plan is based on? I was hoping I could = then run Explain as if I had the data.
3D""= --Apple-Mail=_6898639E-F4C4-4ED9-94AE-00D0AB084642--