From: Stephen Frost <sfrost@snowman.net>
To: Arup Rakshit <ar@zeit.io>
Cc: pgsql-general@postgresql.org
Subject: Re: Why my query not doing index only scan
Date: Mon, 10 Sep 2018 08:53:22 -0400
Message-ID: <20180910125322.GX4184@tamriel.snowman.net> (raw)
In-Reply-To: <E372E9BA-6DCB-4D46-AC9A-0E4B3192A910@zeit.io>
References: <C7195132-E8C4-4914-B96D-F9A2F166C18A@zeit.io>
<20180910112817.GW4184@tamriel.snowman.net>
<E372E9BA-6DCB-4D46-AC9A-0E4B3192A910@zeit.io>
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
Attachments:
signature.asc (application/pgp-signature, 818B) download
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: sfrost@snowman.net, ar@zeit.io
Subject: Re: Why my query not doing index only scan
In-Reply-To: <20180910125322.GX4184@tamriel.snowman.net>
References: <C7195132-E8C4-4914-B96D-F9A2F166C18A@zeit.io> <20180910112817.GW4184@tamriel.snowman.net> <E372E9BA-6DCB-4D46-AC9A-0E4B3192A910@zeit.io> <20180910125322.GX4184@tamriel.snowman.net>
* 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