pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mladen Gogala <gogala.mladen@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Incremental backup
Date: Thu, 28 Oct 2021 21:14:53 -0400
Message-ID: <3d5f2552-c819-c423-cb37-e190f74ea37f@gmail.com> (raw)
In-Reply-To: <VisenaEmail.61.196cd4fcb0034e5c.17cc8ec9428@tc7-visena>
References: <CAD_UXMakmNELSH+EguMLwoDnfOSBza3RHnGP5fKA9A7t=-TMPQ@mail.gmail.com>
	<4ad9560c-d6f7-3f74-b577-cf72c93195d0@aklaver.com>
	<68943e88-7d6b-edb3-90b5-782b9fb5fcbd@gmail.com>
	<57f54e84-c5f2-84fe-6e65-de5f4ddfdd47@aklaver.com>
	<e539fda9-5b0c-e4b0-1e28-64278f72b38f@gmail.com>
	<f16610db-9519-390f-1a56-1590d68b44ab@aklaver.com>
	<995bab59-10e3-eaa9-2b93-afb0474595cd@gmail.com>
	<a5027f17-ca2e-ce7b-a42f-e291f13b156d@aklaver.com>
	<c7d0a9da-5d4c-86cd-33c9-cb4a3fa69086@gmail.com>
	<20211028200853.GA1020@momjian.us>
	<c5e85f3a-0bb5-e468-a06c-d1885b7eacd0@gmail.com>
	<VisenaEmail.61.196cd4fcb0034e5c.17cc8ec9428@tc7-visena>


On 10/28/21 18:07, Andreas Joseph Krogh wrote:
> I think everybody agrees that incremental backup /per database/, and 
> not cluster-wide, is nice, and it would be nice if PG supported it. 
> But, given the way PG is architectured, having cluster-wide WALs, 
> that's not an easy task to implement.
> Repeating "other databases have it" doesn't change that.
> --
> Andreas Joseph Krogh

I am not advocating for the database level incremental backups, but all 
databases that have it also have cluster wide/instance wide WAL logs. 
Cluster wide WAL logs do not make database level incremental backups 
hard. Both Oracle and DB2 have database level incremental backups and 
both have cluster wide WAL (redo or logs). So does SQL*Server which is a 
bit specific because its log is used for both recovery, as WAL, and undo 
so its very different from Postgres. Also, SQL Server is, to my 
knowledge, the only database which doesn't use MVCC.

The technology that all of those databases employ is a bitmap device 
which has one bit per each database block. Full backups set all bits to 
0 and whenever block is modified, the corresponding bit is set to 1. The 
backup tool in the incremental mode then only copies blocks with the 
bitmap value of 1. I am not too thrilled by that implementation. In 
particular, with Oracle there were bugs with database restore, 
"duplicate database" operation, global cache locks and instance latches. 
I've had quite a few headaches with RMAN cumulative incremental backups. 
My preferred method of backup is storage snapshot. Snapshots then can 
be  backed up to other arrays (NetApp SnapVault, Hitachi HUR, EMC SRDF)  
or can be backed up to deduplicated offline storage like AWS Glacier or 
EMC Data Domain using simple file level utilities. Once snapshot is 
taken, it is a read-only file system and the files are no longer opened 
by the database processes.

The classic file level backup tools like pg_basebackup or rman are 
pretty much unusable once your database hits 50 TB or so. With 50TB 
database, your RTO (Recovery Time Objective) will be in days. You can 
only push around 3TB/hour down a 10Gbit Ethernet pipe. On the other hand 
companies like Facebook. Amazon, Walmart or Target are losing hundreds 
of thousands USD per hour of downtime. Downtime of 15 hours or longer is 
completely unacceptable. Backup is only the last line of defense. It 
should only be used if everything else fails. And if you have to use 
file level tool like pg_basebackup and tar to restore your VLDB, you 
should also get your resume ready.

Incremental backups are awkward and ungainly. You have to restore the 
full backup and all incrementals taken since the last full. After that, 
you must apply the remaining WAL files. So, by definition, restoring 
incremental backup is, by definition, longer than restoring a full 
backup. So, if you have to take a backup, get yourself a deduplicating 
backup utility. Deduplication will only save the backup blocks that are 
different from the previous backup. In other words, you can do a daily 
full backup with the space expenditure of an incremental backup. Also, 
if you need backups because of regulatory reasons (HIPAA, SOX), 
incremental backups will not do.

Long story short, there are much more important things to do on Postgres 
than incremental database level backups. BTW, Chuck Norris can take and 
incremental database level backup of a Postgres database and recover 
database without restoring the preceding full backup. I am not sure 
whether Chuck Norris is a member of Postgres steering committee.

-- 
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
https://dbwhisperer.wordpress.com

view thread (31+ messages)  latest in thread

Message-ID: <3d5f2552-c819-c423-cb37-e190f74ea37f@gmail.com>
Permalink:  ../3d5f2552-c819-c423-cb37-e190f74ea37f@gmail.com/
Also on:    postgresql.org/message-id/3d5f2552-c819-c423-cb37-e190f74ea37f@gmail.com

 · 

reply

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: gogala.mladen@gmail.com
  Subject: Re: Incremental backup
  In-Reply-To: <3d5f2552-c819-c423-cb37-e190f74ea37f@gmail.com>
  References: <CAD_UXMakmNELSH+EguMLwoDnfOSBza3RHnGP5fKA9A7t=-TMPQ@mail.gmail.com> <4ad9560c-d6f7-3f74-b577-cf72c93195d0@aklaver.com> <68943e88-7d6b-edb3-90b5-782b9fb5fcbd@gmail.com> <57f54e84-c5f2-84fe-6e65-de5f4ddfdd47@aklaver.com> <e539fda9-5b0c-e4b0-1e28-64278f72b38f@gmail.com> <f16610db-9519-390f-1a56-1590d68b44ab@aklaver.com> <995bab59-10e3-eaa9-2b93-afb0474595cd@gmail.com> <a5027f17-ca2e-ce7b-a42f-e291f13b156d@aklaver.com> <c7d0a9da-5d4c-86cd-33c9-cb4a3fa69086@gmail.com> <20211028200853.GA1020@momjian.us> <c5e85f3a-0bb5-e468-a06c-d1885b7eacd0@gmail.com> <VisenaEmail.61.196cd4fcb0034e5c.17cc8ec9428@tc7-visena> <3d5f2552-c819-c423-cb37-e190f74ea37f@gmail.com>

* 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