Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l9UZr-0006He-4h for pgsql-general@arkaria.postgresql.org; Tue, 09 Feb 2021 15:05:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l9UZp-0006Qx-Oi for pgsql-general@arkaria.postgresql.org; Tue, 09 Feb 2021 15:05:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l9UZp-0006Qq-Hg for pgsql-general@lists.postgresql.org; Tue, 09 Feb 2021 15:05:17 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l9UZj-0008Ss-5C for pgsql-general@lists.postgresql.org; Tue, 09 Feb 2021 15:05:17 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 119F556N861907; Tue, 9 Feb 2021 10:05:06 -0500 From: Tom Lane To: =?utf-8?B?VGhvcnN0ZW4gU2Now7ZuaW5n?= cc: pgsql-general@lists.postgresql.org Subject: Re: Increased size of database dump even though LESS consumed storage In-reply-to: <984279108.20210209105618@am-soft.de> References: <984279108.20210209105618@am-soft.de> Comments: In-reply-to =?utf-8?B?VGhvcnN0ZW4gU2Now7ZuaW5n?= message dated "Tue, 09 Feb 2021 10:56:18 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <861905.1612883105.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 09 Feb 2021 10:05:05 -0500 Message-ID: <861906.1612883105@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk =3D?utf-8?B?VGhvcnN0ZW4gU2Now7ZuaW5n?=3D writes: > for various reasons I've migrated my database schema from 4 tables > with some additional indexes to keep integrity and stuff to 1 table > only. That made some of the former used indexes obsolete and resulted > in overall less consumed storage: > The old schema consumed ~42 GiB, while the new is ~16 GiB without the > formerly available indexes and ~25 GiB with the same logical indexes. > Though, a created dump of the new schema has increased from ~5,52 GiB > to 6,38 GiB. Of course I'm using the same settings to create both > dumps: >> pg_dump.exe "--username=3D%USERNAME%" "--encoding=3DUTF-8" "--compress=3D= 9" "--format=3Dc" "--dbname=3D%DB_NAME%" > "%DMP_PATH%" > My expectation was that the dump would be smaller as well, because the > data itself is the same, while lots of duplicate IDs, obsolete indexes > etc. in not available tables anymore have been removed. Removing indexes won't in itself make any noticeable difference in the size of pg_dump output, since an index is just represented by a CREATE INDEX (or equivalent) command. My guess is that the rearrangement somehow made the table data less amenable to compression. gzip depends on finding similar substrings within a fairly narrow window (a few KB), so at least in principle, just changing the order of rows could make a difference. I'd sort of expect compression opportunity losses to more or less balance out with opportunity gains over such a large data volume, but maybe you were unlucky. Or perhaps the move into a single table was done in such a way that it actually decreased locality-of-reference, eg maybe similar rows were grouped before and now they're not. regards, tom lane