Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1egA2Q-0000UV-2R for pgsql-admin@arkaria.postgresql.org; Mon, 29 Jan 2018 14:03:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1egA2P-000149-7P for pgsql-admin@arkaria.postgresql.org; Mon, 29 Jan 2018 14:03:57 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1egA2P-000140-0l for pgsql-admin@lists.postgresql.org; Mon, 29 Jan 2018 14:03:57 +0000 Received: from mx2.mailbox.org ([80.241.60.215]) by magus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1egA2G-00039n-Jz for pgsql-admin@lists.postgresql.org; Mon, 29 Jan 2018 14:03:56 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id 7B0F240F47; Mon, 29 Jan 2018 15:03:46 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id rmU5eaDiRsIg; Mon, 29 Jan 2018 15:03:42 +0100 (CET) Message-ID: <1517234620.2622.41.camel@cybertec.at> Subject: Re: deduplicating backup of multiple pg_dump dumps From: Laurenz Albe To: Egor Duda , pgsql-admin@lists.postgresql.org Date: Mon, 29 Jan 2018 15:03:40 +0100 In-Reply-To: <5f4d2bdd-e0b6-35e7-501d-e37e5e41a92f@gmail.com> References: <5f4d2bdd-e0b6-35e7-501d-e37e5e41a92f@gmail.com> Organization: Cybertec Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Egor Duda wrote: > I've recently tried to use borg backup (https://borgbackup.readthedocs.io/) to store multiple > PostgreSQL database dumps, and encountered a problem. Due to nondeterministic nature of pg_dump it > reorders data tables rows on each invocation, which breaks borg backup chunking and deduplication > algorithm. > > This means that each next dump in backup almost never reuses data from previous dumps, and so it's > not possible to store multiple database dumps as efficiently as possible. > > I wonder if there's any way to force pg_dump use some predictable ordering of data rows (for > example, by primary key, where possible) to make dumps more uniform, similar to mysqldump > --order-by-primary option? There is no such option. I think you would be better off with physical backups using "pg_basebackup" if you want to deduplicate, at least if deduplication is on the block level. Yours, Laurenz Albe