Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cVYRl-00023a-P6 for pgsql-performance@arkaria.postgresql.org; Mon, 23 Jan 2017 06:49:45 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cVYRl-0003d4-AV for pgsql-performance@arkaria.postgresql.org; Mon, 23 Jan 2017 06:49:45 +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.84_2) (envelope-from ) id 1cVYRj-0003ZI-Ln for pgsql-performance@postgresql.org; Mon, 23 Jan 2017 06:49:43 +0000 Received: from tamriel.snowman.net ([72.66.115.51]) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cVYRg-0008MR-Ml for pgsql-performance@postgresql.org; Mon, 23 Jan 2017 06:49:42 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 670AE5F796; Mon, 23 Jan 2017 01:48:39 -0500 (EST) Date: Mon, 23 Jan 2017 01:48:39 -0500 From: Stephen Frost To: Vladimir Borodin Cc: "pgsql-performance@postgresql.org" Subject: Re: Backup taking long time !!! Message-ID: <20170123064839.GT18360@tamriel.snowman.net> References: <20170120122224.GF18360@tamriel.snowman.net> <20170120134054.GH18360@tamriel.snowman.net> <7696A57C-C871-4A45-9141-FFD5F75CCB65@simply.name> <20170120150646.GP18360@tamriel.snowman.net> <17D95770-42B6-4FF5-80FF-465C77119A27@simply.name> <20170120165922.GS18360@tamriel.snowman.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Xm1wk/WBwRlpvc4I" Content-Disposition: inline In-Reply-To: X-Editor: Vim http://www.vim.org/ X-Info: http://www.snowman.net X-Operating-System: Linux/3.13.0-91-generic (x86_64) X-Uptime: 01:44:53 up 198 days, 8:09, 5 users, load average: 0.01, 0.07, 0.11 User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -5.1 (-----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org --Xm1wk/WBwRlpvc4I Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Vladimir, * Vladimir Borodin (root@simply.name) wrote: > > 20 =D1=8F=D0=BD=D0=B2. 2017 =D0=B3., =D0=B2 19:59, Stephen Frost =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB(=D0=B0): > >>> How are you testing your backups..? Do you have page-level checksums > >>> enabled on your database? =20 > >>=20 > >> Yep, we use checksums. We restore latest backup with recovery_target = =3D 'immediate' and do COPY tablename TO '/dev/null=E2=80=99 with checking = exit code for each table in each database (in several threads, of course). > >=20 > > Right, unfortunately that only checks the heap pages, it won't help with > > corruption happening in an index file or other files which have a > > checksum. >=20 > That=E2=80=99s fine for us because indexes could be rebuilt. The main ide= a is the guarantee that data would not be lost. Fair enough, however, if you don't check that the indexes are valid then you could end up with corruption in the database if you start operating against such a recovered database. Consider what happens on a 'primary key' lookup or insert- if the index doesn't find a conflicting tuple (perhaps because the index is corrupt), then it will happily allow the INSERT to go through, even though it should have been prevented. Indexes are a *really* important component to having a valid database. If you aren't checking the validity of them, then you're running the risk of being exposed to corruption in them, either ongoing or when restoring. If you *always* rebuild your indexes when restoring from a backup, then you should be fine, of course, but if you're going to do that then you might consider using pg_dump instead, which would do that and validate all foreign key references too. Thanks! Stephen --Xm1wk/WBwRlpvc4I Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJYhadHAAoJEO1sijiDR2RVNPAP/3hXQjZtbKrB1DW3CfMxugu2 16WtKNN0g1JU3YX+FddcihXVC0duPIGa2bHbh2VwTVOHQlJbkY3Jw6GU9q5K8GeE 7lVVzVmJjbKMpsiWmWCImIJ5C4eOlc6R175y9Bac7L1XbX+Yqm3Dtx+o4dd2LFZd PzsSIcq9ngiKiTkjouZmhcXcSpavjwbFoMLGBqnKsxnqu/n0IfvfB0KeqFD8P0J/ Qe3jKeONA+RZkeU9HakFWSHJP1iQWnBITTGf0OvMZXADwJSSBooycdyZk9Z+pFQo qaSV2zri8sQwsoCY8lJjHtYnslW0XHOvcmbL5hPazxOGlS6DJGb/dsohpr/ZCQ71 XX/iPvLLyeg/XyEn9Fs47EMKdSC8OkW1UsS8avTWwLMLNKp4tL5fL06k+B3uBYqE dbORkRjvFChIgrbmgaFpLQfNIA8AUfeZmdrJZqs3LfL0h+CmvcsUaMiseh7MQAkI AJK1lfj7ZPBArviGb3+z7ExUhMmMl23XxnzTgCJVo/lPBZOJX1ic4JwIqC/V8J9B jERw6WmIWIPhvno09rAD0hokdha91iA1o8UFum0lCqxYVjSKT4rAVyIFD1TRzeh0 K8Z7yrtTOr84k60CULXykofTWdVU0cCBXvng9Rb2Kjky2q5VVyNuGnRpFuQIOCzH 8zXPwA8EPPmKLV6j0or/ =EDNA -----END PGP SIGNATURE----- --Xm1wk/WBwRlpvc4I--