Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fzLh6-0001JE-6k for pgsql-general@arkaria.postgresql.org; Mon, 10 Sep 2018 12:53:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fzLh4-0001H9-GR for pgsql-general@arkaria.postgresql.org; Mon, 10 Sep 2018 12:53:30 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fzLh4-0001H2-59 for pgsql-general@lists.postgresql.org; Mon, 10 Sep 2018 12:53:30 +0000 Received: from tamriel.snowman.net ([96.255.250.162]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fzLgx-0004sv-8j for pgsql-general@postgresql.org; Mon, 10 Sep 2018 12:53:28 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 664795F79C; Mon, 10 Sep 2018 08:53:22 -0400 (EDT) Date: Mon, 10 Sep 2018 08:53:22 -0400 From: Stephen Frost To: Arup Rakshit Cc: pgsql-general@postgresql.org Subject: Re: Why my query not doing index only scan Message-ID: <20180910125322.GX4184@tamriel.snowman.net> References: <20180910112817.GW4184@tamriel.snowman.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="zOTFI1MayFoZtDo5" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --zOTFI1MayFoZtDo5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Greetings, * Arup Rakshit (ar@zeit.io) wrote: > I would like to ask one more question related to this topic. When I take a dump from production, and restore it to development DB, what are the commands I generally need to run to dev deb quack close to production? The best way to get a prod-like environment in development is to use a file-level backup tool, like pgBackRest. There's a few nice things that does: - Copies the database files at a physical level, making it much closer to what prod is like - Checks your database checksums (if you have them enabled, which hopefully you do, see initdb -k) - Verifies your backup/restore approach - Provides the fastest way to perform a restore in the event of an issue - Allows you to do point-in-time-recovery (PITR) Using pg_dump/pg_restore takes a logical export of the database and then imports it into a new PG cluster. Even if you do VACUUM ANALYZE after doing pg_dump/restore, you're going to end up with (somewhat, at least) different stats, all the tables will be completely packed (no bloat, no space for new tuples to go into existing pages), all of the indexes will be completely rebuilt and pristine, etc. In the end, it's pretty different and while it'll behavior in a similar manner to prod in a lot of ways, there'll be a lot of ways it doesn't too. Thanks! Stephen --zOTFI1MayFoZtDo5 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJblmlCAAoJEO1sijiDR2RVQ0MP/jqTSweWcPkEYzNKVRRbG4C1 83ejTKY4zIMtJmXDprrRdi5ixXFHL4PNrRm3OcFPIg+feWBRJlzsDMP/0AjJ3fSu S1bI1KSU4IgnA1tD5cx3nJ/8/yb3zmDBaWbiw7cHudK2Bb2Eu3UdhWgQA4JNYoG0 2PhQPnax0KpRRPZdYLjVh2isrkyWgHKH1BiaSdtuJw2kFbl+ZC9b/zUMGz87FvYm hTt2p94eB63NTOB5/z7F2RCikUVt7rClyQoqtXQd+l95zO2eoKnYMuO0Ldimgup2 OK+FS8oSrv9Hfgh/9j2JJYffrV2WgY2TEk30Bo70I0Pjg2AS8IAsECsQK3DduZAh eQcykXRfGgkVsRBP8YLKqy995IthgALfSXzpZsDKavA/oV/9kXjFavX9rCZ14YyV XSnkHfO/8LiHMyaXuglAeE8z6ndqq8OyNeLqQAmz8QjLy5qPD96bsLU27aLRNxA1 ZTIS2z0B8M4915AsxFKLQv/e1Y0iVRn5e0/s3fAhJ/KH4iPfeoBOY47VNPq6lLxC NB508GGPIyDuu0w6xaKobIe0l2jB45m9HavDmsVvAZJx6AuFyHn1qs/cKodFnfoT w0o4T+5f9sDGL7X/cb0gtV9igXnvOXn2BPNy3uQbFoquwrG1NH+Mrhs3Xw32VhPX DSriqtRU/oCMjxWLkVpj =JlGj -----END PGP SIGNATURE----- --zOTFI1MayFoZtDo5--